libDAI
Public Member Functions | Private Attributes | List of all members
dai::FRegion Class Reference

An FRegion is a factor with a counting number. More...

#include <dai/regiongraph.h>

Inheritance diagram for dai::FRegion:
dai::TFactor< Real >

Public Member Functions

 FRegion ()
 Default constructor. More...
 
 FRegion (const Factor &x, Real c)
 Constructs from a factor and a counting number. More...
 
const Realc () const
 Returns constant reference to counting number. More...
 
Realc ()
 Returns reference to counting number. More...
 
- Public Member Functions inherited from dai::TFactor< Real >
 TFactor (Realp=1)
 Constructs factor depending on no variables with value p. More...
 
 TFactor (const Var &v)
 Constructs factor depending on the variable v with uniform distribution. More...
 
 TFactor (const VarSet &vars)
 Constructs factor depending on variables in vars with uniform distribution. More...
 
 TFactor (const VarSet &vars, Realp)
 Constructs factor depending on variables in vars with all values set to p. More...
 
 TFactor (const VarSet &vars, const std::vector< S > &x)
 Constructs factor depending on variables in vars, copying the values from a std::vector<> More...
 
 TFactor (const VarSet &vars, const Real *p)
 Constructs factor depending on variables in vars, copying the values from an array. More...
 
 TFactor (const VarSet &vars, const TProb< Real > &p)
 Constructs factor depending on variables in vars, copying the values from p. More...
 
 TFactor (const std::vector< Var > &vars, const std::vector< Real > &p)
 Constructs factor depending on variables in vars, permuting the values given in p accordingly. More...
 
void set (size_t i, Realval)
 Sets i 'th entry to val. More...
 
Real get (size_t i) const
 Gets i 'th entry. More...
 
const TProb< Real > & p () const
 Returns constant reference to value vector. More...
 
TProb< Real > & p ()
 Returns reference to value vector. More...
 
Real operator[] (size_t i) const
 Returns a copy of the i 'th entry of the value vector. More...
 
const VarSetvars () const
 Returns constant reference to variable set (i.e., the variables on which the factor depends) More...
 
VarSetvars ()
 Returns reference to variable set (i.e., the variables on which the factor depends) More...
 
size_t nrStates () const
 Returns the number of possible joint states of the variables on which the factor depends, $\prod_{l\in L} S_l$. More...
 
Real entropy () const
 Returns the Shannon entropy of *this, $-\sum_i p_i \log p_i$. More...
 
Real max () const
 Returns maximum of all values. More...
 
Real min () const
 Returns minimum of all values. More...
 
Real sum () const
 Returns sum of all values. More...
 
Real sumAbs () const
 Returns sum of absolute values. More...
 
Real maxAbs () const
 Returns maximum absolute value of all values. More...
 
bool hasNaNs () const
 Returns true if one or more values are NaN. More...
 
bool hasNegatives () const
 Returns true if one or more values are negative. More...
 
Real strength (const Var &i, const Var &j) const
 Returns strength of this factor (between variables i and j), as defined in eq. (52) of [MoK07b]. More...
 
bool operator== (const TFactor< Real > &y) const
 Comparison. More...
 
std::string toString () const
 Formats a factor as a string. More...
 
TFactor< Realoperator- () const
 Returns negative of *this. More...
 
TFactor< Realabs () const
 Returns pointwise absolute value. More...
 
TFactor< Realexp () const
 Returns pointwise exponent. More...
 
TFactor< Reallog (bool zero=false) const
 Returns pointwise logarithm. More...
 
TFactor< Realinverse (bool zero=true) const
 Returns pointwise inverse. More...
 
TFactor< Realnormalized (ProbNormType norm=NORMPROB) const
 Returns normalized copy of *this, using the specified norm. More...
 
TFactor< Realoperator- (Realx) const
 Returns difference of *this and scalar x. More...
 
TFactor< Realoperator+ (Realx) const
 Returns sum of *this and scalar x. More...
 
TFactor< Realoperator* (Realx) const
 Returns product of *this with scalar x. More...
 
TFactor< Realoperator/ (Realx) const
 Returns quotient of *this with scalar x. More...
 
TFactor< Realoperator^ (Realx) const
 Returns *this raised to the power x. More...
 
TFactor< Realoperator- (const TFactor< Real > &g) const
 Returns *this minus g. More...
 
TFactor< Realoperator+ (const TFactor< Real > &g) const
 Returns sum of *this and g. More...
 
TFactor< Realoperator* (const TFactor< Real > &g) const
 Returns product of *this with g. More...
 
TFactor< Realoperator/ (const TFactor< Real > &g) const
 Returns quotient of *this by f (where division by zero yields zero) More...
 
TFactor< RealbinaryTr (const TFactor< Real > &g, binOp op) const
 Returns result of applying binary operation op on two factors, *this and g. More...
 
TFactor< Real > & randomize ()
 Draws all values i.i.d. from a uniform distribution on [0,1) More...
 
TFactor< Real > & setUniform ()
 Sets all values to $1/n$ where n is the number of states. More...
 
TFactor< Real > & takeAbs ()
 Applies absolute value pointwise. More...
 
TFactor< Real > & takeExp ()
 Applies exponent pointwise. More...
 
TFactor< Real > & takeLog (bool zero=false)
 Applies logarithm pointwise. More...
 
Real normalize (ProbNormType norm=NORMPROB)
 Normalizes factor using the specified norm. More...
 
TFactor< Real > & fill (Realx)
 Sets all values to x. More...
 
TFactor< Real > & operator+= (Realx)
 Adds scalar x to each value. More...
 
TFactor< Real > & operator-= (Realx)
 Subtracts scalar x from each value. More...
 
TFactor< Real > & operator*= (Realx)
 Multiplies each value with scalar x. More...
 
TFactor< Real > & operator/= (Realx)
 Divides each entry by scalar x. More...
 
TFactor< Real > & operator^= (Realx)
 Raises values to the power x. More...
 
TFactor< Real > & operator+= (const TFactor< Real > &g)
 Adds g to *this. More...
 
TFactor< Real > & operator-= (const TFactor< Real > &g)
 Subtracts g from *this. More...
 
TFactor< Real > & operator*= (const TFactor< Real > &g)
 Multiplies *this with g. More...
 
TFactor< Real > & operator/= (const TFactor< Real > &g)
 Divides *this by g (where division by zero yields zero) More...
 
TFactor< Real > & binaryOp (const TFactor< Real > &g, binOp op)
 Applies binary operation op on two factors, *this and g. More...
 
TFactor< Realslice (const VarSet &vars, size_t varsState) const
 Returns a slice of *this, where the subset vars is in state varsState. More...
 
TFactor< Realembed (const VarSet &vars) const
 Embeds this factor in a larger VarSet. More...
 
TFactor< Realmarginal (const VarSet &vars, bool normed=true) const
 Returns marginal on vars, obtained by summing out all variables except those in vars, and normalizing the result if normed == true. More...
 
TFactor< RealmaxMarginal (const VarSet &vars, bool normed=true) const
 Returns max-marginal on vars, obtained by maximizing all variables except those in vars, and normalizing the result if normed == true. More...
 

Private Attributes

Real _c
 Counting number. More...
 

Detailed Description

An FRegion is a factor with a counting number.

Constructor & Destructor Documentation

dai::FRegion::FRegion ( )
inline

Default constructor.

dai::FRegion::FRegion ( const Factor x,
Real  c 
)
inline

Constructs from a factor and a counting number.

Member Function Documentation

const Real& dai::FRegion::c ( ) const
inline

Returns constant reference to counting number.

Real& dai::FRegion::c ( )
inline

Returns reference to counting number.

Member Data Documentation

Real dai::FRegion::_c
private

Counting number.


The documentation for this class was generated from the following file: