![]() |
aGrUM
0.20.3
a C++ library for (probabilistic) graphical models
|
Defines a continuous random variable. More...
#include <continuousVariable.h>
Public Member Functions | |
template<> | |
float | operator[] (const std::string &str) const |
template<> | |
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. More... | |
ContinuousVariable (const ContinuousVariable< GUM_SCALAR > &from) | |
Copy Constructor. More... | |
template<typename TX_VAL > | |
ContinuousVariable (const ContinuousVariable< TX_VAL > &from) | |
generalized copy constructor More... | |
ContinuousVariable (ContinuousVariable< GUM_SCALAR > &&from) | |
move constructor More... | |
virtual | ~ContinuousVariable () |
destructor More... | |
virtual ContinuousVariable< GUM_SCALAR > * | clone () const |
Copy Factory. More... | |
Operators | |
ContinuousVariable< GUM_SCALAR > & | operator= (const ContinuousVariable< GUM_SCALAR > &from) |
copy operator More... | |
template<typename TX_VAL > | |
ContinuousVariable< GUM_SCALAR > & | operator= (const ContinuousVariable< TX_VAL > &from) |
generalized copy operator More... | |
ContinuousVariable< GUM_SCALAR > & | operator= (ContinuousVariable< GUM_SCALAR > &&from) |
move operator More... | |
GUM_SCALAR | operator[] (const std::string &str) const |
returns the T_VAL corresponding to a string More... | |
Accessors / Modifiers | |
GUM_SCALAR | lowerBound () const |
returns the lower bound of the domain of the variable More... | |
virtual double | lowerBoundAsDouble () const |
returns the lower bound of the domain of the variable as a double More... | |
GUM_SCALAR | upperBound () const |
returns the upper bound of the domain of the variable More... | |
virtual double | upperBoundAsDouble () const |
returns the upper bound of the domain of the variable as a double More... | |
void | setLowerBound (const GUM_SCALAR &new_bound) |
updates the lower bound of the domain of the variable More... | |
virtual void | setLowerBoundFromDouble (const double new_bound) |
updates the lower bound of the domain of the variable More... | |
void | setUpperBound (const GUM_SCALAR &new_bound) |
updates the lower bound of the domain of the variable More... | |
virtual void | setUpperBoundFromDouble (const double new_bound) |
updates the lower bound of the domain of the variable More... | |
virtual std::string | label (const GUM_SCALAR &value) const |
returns a string containing the value of the variable passed in argument More... | |
bool | belongs (const GUM_SCALAR &value) const |
Returns true if the param belongs to the domain of the variable. More... | |
virtual const std::string | domain () const |
returns the domain of the variable as a string More... | |
virtual VarType | varType () const |
returns the type of the variable More... | |
std::string | toString () const |
string version of *this More... | |
std::string | toStringWithDescription () const |
string version of *this using description attribute instead of name. More... | |
Operators | |
virtual bool | operator== (const Variable &aRV) const |
equality operator More... | |
virtual bool | operator!= (const Variable &aRV) const |
inequality operator More... | |
Accessors / Modifiers | |
void | setName (const std::string &theValue) |
sets the name of the variable More... | |
const std::string & | name () const |
returns the name of the variable More... | |
void | setDescription (const std::string &theValue) const |
sets the description of the variable More... | |
const std::string & | description () const |
returns the description of the variable More... | |
Protected Member Functions | |
void | copy_ (const Variable &aRV) |
protected copy More... | |
Friends | |
template<typename TX_VAL > | |
class | ContinuousVariable |
Defines a continuous random variable.
Definition at line 46 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 | ) |
Copy Constructor.
gum::ContinuousVariable< GUM_SCALAR >::ContinuousVariable | ( | const ContinuousVariable< TX_VAL > & | from | ) |
generalized copy constructor
gum::ContinuousVariable< GUM_SCALAR >::ContinuousVariable | ( | ContinuousVariable< GUM_SCALAR > && | from | ) |
move constructor
|
virtual |
destructor
bool gum::ContinuousVariable< GUM_SCALAR >::belongs | ( | const GUM_SCALAR & | value | ) | const |
Returns true if the param belongs to the domain of the variable.
|
virtual |
|
protectedinherited |
protected copy
aRV | to be copied |
|
inherited |
returns the description of the variable
|
virtual |
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
inequality operator
ContinuousVariable< GUM_SCALAR >& gum::ContinuousVariable< GUM_SCALAR >::operator= | ( | const ContinuousVariable< GUM_SCALAR > & | from | ) |
copy operator
ContinuousVariable< GUM_SCALAR >& gum::ContinuousVariable< GUM_SCALAR >::operator= | ( | const ContinuousVariable< TX_VAL > & | from | ) |
generalized copy operator
ContinuousVariable< GUM_SCALAR >& gum::ContinuousVariable< GUM_SCALAR >::operator= | ( | ContinuousVariable< GUM_SCALAR > && | from | ) |
move operator
equality operator
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 |
float gum::ContinuousVariable< float >::operator[] | ( | const std::string & | str | ) | const |
double gum::ContinuousVariable< double >::operator[] | ( | const std::string & | str | ) | const |
|
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
std::string gum::ContinuousVariable< GUM_SCALAR >::toStringWithDescription | ( | ) | const |
string version of *this using description attribute instead of name.
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.
|
friend |
Definition at line 180 of file continuousVariable.h.
|
private |
Definition at line 174 of file continuousVariable.h.
|
private |
Definition at line 177 of file continuousVariable.h.