X-Git-Url: http://git.tuebingen.mpg.de/?p=libdai.git;a=blobdiff_plain;f=include%2Fdai%2Fvarset.h;h=5fa87ae781c3e7861626f224e6378a32443bd2e8;hp=e45e40de9d7b48d4eba1b8c1ee35219e85fb5f35;hb=8aaa6ae116f8f5aadbf795591f118b08b4dd5667;hpb=05997bd8754e1fa0c95bbe372bcec747bb509c80 diff --git a/include/dai/varset.h b/include/dai/varset.h index e45e40d..5fa87ae 100644 --- a/include/dai/varset.h +++ b/include/dai/varset.h @@ -46,10 +46,10 @@ namespace dai { /// Represents a set of variables. /** \note A VarSet is implemented using a SmallSet instead * of the more natural std::set because of efficiency reasons. - * That is, internally, the variables in the set are sorted according - * to their labels: the set of variables \f$\{x_l\}_{l\in L}\f$ is - * represented as a vector \f$(x_{l(0)},x_{l(1)},\dots,x_{l(|L|-1)})\f$ - * where \f$l(0) < l(1) < \dots < l(|L|-1)\f$ + * That is, internally, the variables in the set are sorted according + * to their labels: the set of variables \f$\{x_l\}_{l\in L}\f$ is + * represented as a vector \f$(x_{l(0)},x_{l(1)},\dots,x_{l(|L|-1)})\f$ + * where \f$l(0) < l(1) < \dots < l(|L|-1)\f$ * and \f$L = \{l(0),l(1),\dots,l(|L|-1)\}\f$. */ class VarSet : public SmallSet { @@ -64,8 +64,8 @@ class VarSet : public SmallSet { /** The number of states of the Cartesian product of the variables in this VarSet * is simply the product of the number of states of each variable in this VarSet. * If *this corresponds with the set \f$\{x_l\}_{l\in L}\f$, - * where variable \f$x_l\f$ has label \f$l\f$, and denoting by \f$S_l\f$ the - * number of possible values ("states") of variable \f$x_l\f$, the number of + * where variable \f$x_l\f$ has label \f$l\f$, and denoting by \f$S_l\f$ the + * number of possible values ("states") of variable \f$x_l\f$, the number of * joint configurations of the variables in \f$\{x_l\}_{l\in L}\f$ is given by \f$\prod_{l\in L} S_l\f$. */ size_t nrStates() { @@ -79,7 +79,7 @@ class VarSet : public SmallSet { VarSet( const Var &n ) : SmallSet(n) {} /// Construct a VarSet with two elements - VarSet( const Var &n1, const Var &n2 ) : SmallSet(n1,n2) {} + VarSet( const Var &n1, const Var &n2 ) : SmallSet(n1,n2) {} /// Construct a VarSet from a range. /** \tparam VarIterator Iterates over instances of type Var. @@ -95,7 +95,7 @@ class VarSet : public SmallSet { * \return The linear index in the Cartesian product of the variables in *this * corresponding with the joint assignment specified by \a states, where it is * assumed that \a states[\a m]==0 for all \a m in *this which are not in \a states. - * + * * The linear index is calculated as follows. The variables in *this are * ordered according to their label (in ascending order); say *this corresponds with * the set \f$\{x_{l(0)},x_{l(1)},\dots,x_{l(n-1)}\}\f$ with \f$l(0) < l(1) < \dots < l(n-1)\f$, @@ -110,9 +110,9 @@ class VarSet : public SmallSet { * \f} * * \note If *this corresponds with \f$\{x_l\}_{l\in L}\f$, and \a states specifies a state - * for each variable \f$x_l\f$ for \f$l\in L\f$, calcState(const std::map &) induces a mapping + * for each variable \f$x_l\f$ for \f$l\in L\f$, calcState(const std::map &) induces a mapping * \f$\sigma : \prod_{l\in L} X_l \to \{0,1,\dots,\prod_{l\in L} S_l-1\}\f$ that - * maps a joint state to a linear index; this is the inverse of the mapping + * maps a joint state to a linear index; this is the inverse of the mapping * \f$\sigma^{-1}\f$ induced by calcStates(size_t). */ size_t calcState( const std::map &states ) { @@ -134,16 +134,16 @@ class VarSet : public SmallSet { * The variables in *this are ordered according to their label (in ascending order); say *this corresponds with * the set \f$\{x_{l(0)},x_{l(1)},\dots,x_{l(n-1)}\}\f$ with \f$l(0) < l(1) < \dots < l(n-1)\f$, * where variable \f$x_l\f$ has label \a l. Denote by \f$S_l\f$ the number of possible values - * ("states") of variable \f$x_l\f$ with label \a l. + * ("states") of variable \f$x_l\f$ with label \a l. * The mapping \a s returned by this function is defined as: * \f{eqnarray*} * s(x_{l(i)}) = \left\lfloor\frac{S \mbox { mod } \prod_{j=0}^{i} S_{l(j)}}{\prod_{j=0}^{i-1} S_{l(j)}}\right\rfloor \qquad \mbox{for all $i=0,\dots,n-1$}. * \f} * where \f$S\f$ denotes the value of \a linearState. * - * \note If *this corresponds with \f$\{x_l\}_{l\in L}\f$, calcStates(size_t) induces a mapping + * \note If *this corresponds with \f$\{x_l\}_{l\in L}\f$, calcStates(size_t) induces a mapping * \f$\sigma^{-1} : \{0,1,\dots,\prod_{l\in L} S_l-1\} \to \prod_{l\in L} X_l\f$ that - * maps a linear index to a joint state; this is the inverse of the mapping \f$\sigma\f$ + * maps a linear index to a joint state; this is the inverse of the mapping \f$\sigma\f$ * induced by calcState(const std::map &). */ std::map calcStates( size_t linearState ) {