libDAI
|
Represents a discrete random variable. More...
#include <dai/var.h>
Public Member Functions | |
Var () | |
Default constructor (creates a variable with label 0 and 0 states) More... | |
Var (size_t label, size_t states) | |
Constructs a variable with a given label and number of states. More... | |
size_t | label () const |
Returns the label. More... | |
size_t & | label () |
Returns reference to label. More... | |
size_t | states () const |
Returns the number of states. More... | |
size_t & | states () |
Returns reference to number of states. More... | |
bool | operator< (const Var &n) const |
Smaller-than operator (only compares labels) More... | |
bool | operator> (const Var &n) const |
Larger-than operator (only compares labels) More... | |
bool | operator<= (const Var &n) const |
Smaller-than-or-equal-to operator (only compares labels) More... | |
bool | operator>= (const Var &n) const |
Larger-than-or-equal-to operator (only compares labels) More... | |
bool | operator!= (const Var &n) const |
Not-equal-to operator (only compares labels) More... | |
bool | operator== (const Var &n) const |
Equal-to operator (only compares labels) More... | |
std::string | toString () const |
Formats a Var as a string. More... | |
Private Attributes | |
size_t | _label |
Label of the variable (its unique ID) More... | |
size_t | _states |
Number of possible values. More... | |
Friends | |
std::ostream & | operator<< (std::ostream &os, const Var &n) |
Writes a Var to an output stream. More... | |
Represents a discrete random variable.
A Var stores the label of the variable (an unsigned integer-valued unique ID) and the number of possible values (states) of that variable. Two Var objects with the same label are assumed to be identical (i.e., it is assumed that they have the same number of possible states).
In the documentation, we use the following notational conventions. The discrete random variable with label is denoted as , and the number of possible values of this variable as ; this is represented in code by the object Var( , ). The set of possible values of variable is denoted .
|
inline |
Default constructor (creates a variable with label 0 and 0 states)
|
inline |
Constructs a variable with a given label and number of states.
|
inline |
Returns the label.
|
inline |
Returns reference to label.
|
inline |
Returns the number of states.
|
inline |
Returns reference to number of states.
|
inline |
Smaller-than operator (only compares labels)
|
inline |
Larger-than operator (only compares labels)
|
inline |
Smaller-than-or-equal-to operator (only compares labels)
|
inline |
Larger-than-or-equal-to operator (only compares labels)
|
inline |
Not-equal-to operator (only compares labels)
|
inline |
Equal-to operator (only compares labels)
|
inline |
Formats a Var as a string.
|
friend |
Writes a Var to an output stream.
|
private |
Label of the variable (its unique ID)
|
private |
Number of possible values.