#include <dai/var.h>
Public Member Functions | |
Var () | |
Default constructor (creates a variable with label 0 and 0 states). | |
Var (size_t label, size_t states) | |
Constructs a variable with a given label and number of states. | |
size_t | label () const |
Returns the label. | |
size_t & | label () |
Returns reference to label. | |
size_t | states () const |
Returns the number of states. | |
size_t & | states () |
Returns reference to number of states. | |
bool | operator< (const Var &n) const |
Smaller-than operator (only compares labels). | |
bool | operator> (const Var &n) const |
Larger-than operator (only compares labels). | |
bool | operator<= (const Var &n) const |
Smaller-than-or-equal-to operator (only compares labels). | |
bool | operator>= (const Var &n) const |
Larger-than-or-equal-to operator (only compares labels). | |
bool | operator!= (const Var &n) const |
Not-equal-to operator (only compares labels). | |
bool | operator== (const Var &n) const |
Equal-to operator (only compares labels). | |
Private Attributes | |
size_t | _label |
Label of the variable (its unique ID). | |
size_t | _states |
Number of possible values. | |
Friends | |
std::ostream & | operator<< (std::ostream &os, const Var &n) |
Writes a Var to an output stream. |
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
.
example_imagesegmentation.cpp, example_permute.cpp, example_sprinkler.cpp, and example_varset.cpp.
dai::Var::Var | ( | ) | [inline] |
Default constructor (creates a variable with label 0 and 0 states).
dai::Var::Var | ( | size_t | label, | |
size_t | states | |||
) | [inline] |
Constructs a variable with a given label and number of states.
size_t dai::Var::label | ( | ) | const [inline] |
size_t& dai::Var::label | ( | ) | [inline] |
Returns reference to label.
size_t dai::Var::states | ( | ) | const [inline] |
size_t& dai::Var::states | ( | ) | [inline] |
Returns reference to number of states.
bool dai::Var::operator< | ( | const Var & | n | ) | const [inline] |
Smaller-than operator (only compares labels).
bool dai::Var::operator> | ( | const Var & | n | ) | const [inline] |
Larger-than operator (only compares labels).
bool dai::Var::operator<= | ( | const Var & | n | ) | const [inline] |
Smaller-than-or-equal-to operator (only compares labels).
bool dai::Var::operator>= | ( | const Var & | n | ) | const [inline] |
Larger-than-or-equal-to operator (only compares labels).
bool dai::Var::operator!= | ( | const Var & | n | ) | const [inline] |
Not-equal-to operator (only compares labels).
bool dai::Var::operator== | ( | const Var & | n | ) | const [inline] |
Equal-to operator (only compares labels).
std::ostream& operator<< | ( | std::ostream & | os, | |
const Var & | n | |||
) | [friend] |
Writes a Var to an output stream.
size_t dai::Var::_label [private] |
Label of the variable (its unique ID).
size_t dai::Var::_states [private] |
Number of possible values.