![]() |
aGrUM 2.3.2
a C++ library for (probabilistic) graphical models
|
Defines a continuous random variable. More...
#include <continuousVariable.h>
Public Member Functions | |
| float | operator[] (const std::string &str) const |
| double | operator[] (const std::string &str) const |
Constructors / Destructors | |
| ContinuousVariable (const std::string &aName, const std::string &aDesc, GUM_SCALAR lower_bound=-std::numeric_limits< GUM_SCALAR >::infinity(), GUM_SCALAR upper_bound=std::numeric_limits< GUM_SCALAR >::infinity()) | |
| Default constructor. | |
| ContinuousVariable (const ContinuousVariable< GUM_SCALAR > &from) | |
| Copy Constructor. | |
| template<typename TX_VAL> | |
| ContinuousVariable (const ContinuousVariable< TX_VAL > &from) | |
| generalized copy constructor | |
| ContinuousVariable (ContinuousVariable< GUM_SCALAR > &&from) | |
| move constructor | |
| virtual | ~ContinuousVariable () |
| destructor | |
| virtual ContinuousVariable< GUM_SCALAR > * | clone () const |
| Copy Factory. | |
Operators | |
| ContinuousVariable< GUM_SCALAR > & | operator= (const ContinuousVariable< GUM_SCALAR > &from) |
| copy operator | |
| template<typename TX_VAL> | |
| ContinuousVariable< GUM_SCALAR > & | operator= (const ContinuousVariable< TX_VAL > &from) |
| generalized copy operator | |
| ContinuousVariable< GUM_SCALAR > & | operator= (ContinuousVariable< GUM_SCALAR > &&from) |
| move operator | |
| GUM_SCALAR | operator[] (const std::string &str) const |
| returns the T_VAL corresponding to a string | |
Accessors / Modifiers | |
| GUM_SCALAR | lowerBound () const |
| returns the lower bound of the domain of the variable | |
| virtual double | lowerBoundAsDouble () const |
| returns the lower bound of the domain of the variable as a double | |
| GUM_SCALAR | upperBound () const |
| returns the upper bound of the domain of the variable | |
| virtual double | upperBoundAsDouble () const |
| returns the upper bound of the domain of the variable as a double | |
| void | setLowerBound (const GUM_SCALAR &new_bound) |
| updates the lower bound of the domain of the variable | |
| virtual void | setLowerBoundFromDouble (const double new_bound) |
| updates the lower bound of the domain of the variable | |
| void | setUpperBound (const GUM_SCALAR &new_bound) |
| updates the lower bound of the domain of the variable | |
| virtual void | setUpperBoundFromDouble (const double new_bound) |
| updates the lower bound of the domain of the variable | |
| virtual std::string | label (const GUM_SCALAR &value) const |
| returns a string containing the value of the variable passed in argument | |
| bool | belongs (const GUM_SCALAR &value) const |
| Returns true if the param belongs to the domain of the variable. | |
| std::string | domain () const final |
| returns the domain of the variable as a string | |
| virtual VarType | varType () const |
| returns the type of the variable | |
| std::string | toString () const |
| string version of *this | |
| std::string | toStringWithDescription () const |
| string version of *this using description attribute instead of name. | |
Operators | |
| bool | operator== (const Variable &aRV) const |
| equality operator | |
Accessors / Modifiers | |
| void | setName (const std::string &theValue) |
| sets the name of the variable | |
| const std::string & | name () const |
| returns the name of the variable | |
| void | setDescription (const std::string &theValue) const |
| sets the description of the variable | |
| const std::string & | description () const |
| returns the description of the variable | |
Protected Member Functions | |
| void | copy_ (const Variable &aRV) |
| protected copy | |
Private Member Functions | |
| bool | _checkSameDomain_ (const Variable &aRV) const final |
| check the domain | |
Private Attributes | |
| GUM_SCALAR | _lower_bound_ |
| GUM_SCALAR | _upper_bound_ |
| std::string | _name_ |
| the name of the variable | |
| std::string | _description_ |
| the description of the variable since description is not a characteristic of a variable, we allow the description to be changed even in a const reference. | |
Friends | |
| template<typename TX_VAL> | |
| class | ContinuousVariable |
Defines a continuous random variable.
Definition at line 67 of file continuousVariable.h.
| gum::ContinuousVariable< GUM_SCALAR >::ContinuousVariable | ( | const std::string & | aName, |
| const std::string & | aDesc, | ||
| GUM_SCALAR | lower_bound = -std::numeric_limits< GUM_SCALAR >::infinity(), | ||
| GUM_SCALAR | upper_bound = std::numeric_limits< GUM_SCALAR >::infinity() ) |
Default constructor.
It is possible to create ContinuousVariable with lower_bound > upper_bound. In this case, the min and the max are swapped. By default, the range of the variable is (-inf,+inf).
| gum::ContinuousVariable< GUM_SCALAR >::ContinuousVariable | ( | const ContinuousVariable< GUM_SCALAR > & | from | ) |
| gum::ContinuousVariable< GUM_SCALAR >::ContinuousVariable | ( | const ContinuousVariable< TX_VAL > & | from | ) |
generalized copy constructor
References ContinuousVariable.
| gum::ContinuousVariable< GUM_SCALAR >::ContinuousVariable | ( | ContinuousVariable< GUM_SCALAR > && | from | ) |
|
virtual |
destructor
|
finalprivatevirtual |
check the domain
this function use the assumption that the concrete type of the variable is the same as *this
Implements gum::Variable.
References _checkSameDomain_().
Referenced by _checkSameDomain_().
| bool gum::ContinuousVariable< GUM_SCALAR >::belongs | ( | const GUM_SCALAR & | value | ) | const |
Returns true if the param belongs to the domain of the variable.
|
virtual |
Copy Factory.
Implements gum::IContinuousVariable.
References ContinuousVariable.
|
protectedinherited |
protected copy
| aRV | to be copied |
References Variable().
|
inherited |
returns the description of the variable
|
finalvirtual |
returns the domain of the variable as a string
Implements gum::Variable.
|
virtual |
returns a string containing the value of the variable passed in argument
| value | the value of the variable we wish to return |
| OutOfBounds | is raised if the value does not belong to the domain of the variable |
| GUM_SCALAR gum::ContinuousVariable< GUM_SCALAR >::lowerBound | ( | ) | const |
returns the lower bound of the domain of the variable
|
virtual |
returns the lower bound of the domain of the variable as a double
Implements gum::IContinuousVariable.
|
inherited |
returns the name of the variable
Referenced by gum::learning::IBNLearner::Database::Database(), gum::Estimator< GUM_SCALAR >::Estimator(), gum::MultiDimImplementation< double >::MultiDimImplementation(), gum::NumericalDiscreteVariable::NumericalDiscreteVariable(), gum::BNdistance< GUM_SCALAR >::_checkCompatibility_(), gum::BayesNet< double >::_copyTensors_(), gum::prm::PRMFactory< GUM_SCALAR >::_retrieveCommonType_(), gum::prm::PRMFactory< GUM_SCALAR >::_retrieveInputs_(), gum::BayesNetFactory< GUM_SCALAR >::_setCPTAndParents_(), gum::Instantiation::add(), gum::FMDP< double >::addCostForAction(), gum::FMDP< GUM_SCALAR >::addVariable(), gum::MultiDimICIModel< GUM_SCALAR >::causalWeight(), gum::Instantiation::chgVal(), gum::GibbsBNdistance< GUM_SCALAR >::computeKL_(), gum::InfluenceDiagram< GUM_SCALAR >::copyStructureAndTables_(), gum::prm::PRMFactory< GUM_SCALAR >::endDiscreteType(), gum::prm::PRMFactory< GUM_SCALAR >::endDiscretizedType(), gum::BayesNetFactory< GUM_SCALAR >::endVariableDeclaration(), gum::FMDPFactory< GUM_SCALAR >::endVariableDeclaration(), gum::Tensor< GUM_SCALAR >::fillWith(), gum::BayesNetFragment< GUM_SCALAR >::nodeId(), gum::Estimator< GUM_SCALAR >::posterior(), gum::Estimator< GUM_SCALAR >::setFromBN(), gum::Instantiation::setValsFrom(), gum::BayesNetFactory< GUM_SCALAR >::setVariable(), gum::BayesNetFactory< GUM_SCALAR >::setVariableValuesUnchecked(), gum::MultiDimFunctionGraph< GUM_SCALAR, TerminalNodePolicy >::toDot(), gum::RangeVariable::toFast(), gum::Estimator< GUM_SCALAR >::update(), and gum::MultiDimFunctionGraph< GUM_SCALAR, TerminalNodePolicy >::varNodeListe().
| ContinuousVariable< GUM_SCALAR > & gum::ContinuousVariable< GUM_SCALAR >::operator= | ( | const ContinuousVariable< GUM_SCALAR > & | from | ) |
| ContinuousVariable< GUM_SCALAR > & gum::ContinuousVariable< GUM_SCALAR >::operator= | ( | const ContinuousVariable< TX_VAL > & | from | ) |
| ContinuousVariable< GUM_SCALAR > & gum::ContinuousVariable< GUM_SCALAR >::operator= | ( | ContinuousVariable< GUM_SCALAR > && | from | ) |
| double gum::ContinuousVariable< double >::operator[] | ( | const std::string & | str | ) | const |
| float gum::ContinuousVariable< float >::operator[] | ( | const std::string & | str | ) | const |
| GUM_SCALAR gum::ContinuousVariable< GUM_SCALAR >::operator[] | ( | const std::string & | str | ) | const |
returns the T_VAL corresponding to a string
| OutOfBounds | is raised if the value does not belong to the domain of the variable |
| TypeError | if the string cannot be converted into a T_VAL |
|
inherited |
sets the description of the variable
| theValue |
| void gum::ContinuousVariable< GUM_SCALAR >::setLowerBound | ( | const GUM_SCALAR & | new_bound | ) |
updates the lower bound of the domain of the variable
| OutOfBounds | is raised if the new bound is higher than the current upper bound. |
|
virtual |
updates the lower bound of the domain of the variable
| OutOfBounds | is raised if the new bound is higher than the current upper bound. |
Implements gum::IContinuousVariable.
|
inherited |
sets the name of the variable
| theValue |
| void gum::ContinuousVariable< GUM_SCALAR >::setUpperBound | ( | const GUM_SCALAR & | new_bound | ) |
updates the lower bound of the domain of the variable
| OutOfBounds | is raised if the new bound is lower than the current lower bound |
|
virtual |
updates the lower bound of the domain of the variable
| OutOfBounds | is raised if the new bound is lower than the current lower bound |
Implements gum::IContinuousVariable.
| std::string gum::ContinuousVariable< GUM_SCALAR >::toString | ( | ) | const |
string version of *this
References toString().
Referenced by toString().
| std::string gum::ContinuousVariable< GUM_SCALAR >::toStringWithDescription | ( | ) | const |
string version of *this using description attribute instead of name.
References toStringWithDescription().
Referenced by toStringWithDescription().
| GUM_SCALAR gum::ContinuousVariable< GUM_SCALAR >::upperBound | ( | ) | const |
returns the upper bound of the domain of the variable
|
virtual |
returns the upper bound of the domain of the variable as a double
Implements gum::IContinuousVariable.
|
virtual |
returns the type of the variable
Implements gum::Variable.
References varType().
Referenced by varType().
|
friend |
Definition at line 207 of file continuousVariable.h.
References ContinuousVariable.
Referenced by ContinuousVariable, ContinuousVariable(), ContinuousVariable(), ContinuousVariable(), clone(), operator=(), operator=(), operator=(), and operator[]().
|
mutableprivateinherited |
the description of the variable since description is not a characteristic of a variable, we allow the description to be changed even in a const reference.
Definition at line 165 of file variable.h.
|
private |
Definition at line 201 of file continuousVariable.h.
|
privateinherited |
the name of the variable
Definition at line 160 of file variable.h.
|
private |
Definition at line 204 of file continuousVariable.h.