|
Darwin
1.10(beta)
|
Factor which stores the value of each assignment explicitly in table form. More...
Public Member Functions | |
| drwnTableFactor (const drwnVarUniversePtr &ptr, drwnTableFactorStorage *storage=NULL) | |
| drwnTableFactor (const drwnTableFactor &psi) | |
| const char * | type () const |
| returns object type as a string (e.g., Foo::type() { return "Foo"; }) | |
| drwnTableFactor * | clone () const |
| returns a copy of the class usually implemented as virtual Foo* clone() { return new Foo(*this); } | |
| size_t | memory () const |
| number of bytes comsumed by the factor data (excludes variables lists, etc) | |
| size_t | entries () const |
| bool | isShared () const |
| void | addVariable (int var) |
| add variable by id | |
| int | indexOf (int var, int val, int indx=0) const |
Returns the index into the data table with variable var taking assignment val. Can be relative to another index (calculated for a different variable-value pair). | |
| int | indexOf (const drwnFullAssignment &assignment) const |
| Returns the index into the data table for a given full assignment. | |
| int | indexOf (const drwnPartialAssignment &assignment) const |
| Returns the index into the data table for a given partial assignment. All variables in the scope of the factor must be defined. | |
| int | valueOf (int var, int indx) const |
Returns the value of variable var for the given index. | |
| void | assignmentOf (int indx, drwnPartialAssignment &assignment) const |
| Returns the assignment for all variables in the scope of the factor for a given index into the data table. | |
| void | assignmentOf (int indx, drwnFullAssignment &assignment) const |
| Returns the assignment for all variables in the scope of the factor for a given index into the data table. | |
| int | indexOfMin () const |
| int | indexOfMax () const |
| pair< int, int > | indexOfMinAndMax () const |
| virtual drwnTableFactor & | initialize () |
| drwnTableFactor & | fill (double alpha) |
| drwnTableFactor & | copy (const double *data) |
| drwnTableFactor & | scale (double alpha) |
| drwnTableFactor & | offset (double alpha) |
| virtual drwnTableFactor & | normalize () |
| bool | save (drwnXMLNode &xml) const |
| write object to XML node (see also write) | |
| bool | load (drwnXMLNode &xml) |
| read object from XML node (see also read) | |
| double | getValueOf (const drwnFullAssignment &y) const |
| Returns the value of the factor for a given (full) assignment. | |
| void | setValueOf (const drwnFullAssignment &y, double val) |
| Sets the value of the factor for a given (full) assignment. | |
| bool | dataCompare (const drwnTableFactor &psi) const |
| bool | dataCompareAndCopy (const drwnTableFactor &psi) |
| double & | operator[] (unsigned index) |
| const double & | operator[] (unsigned index) const |
| drwnTableFactor & | operator= (const drwnTableFactor &psi) |
Public Member Functions inherited from drwnFactor | |
| drwnFactor (const drwnVarUniversePtr &ptr) | |
| create an empty factor | |
| drwnFactor (const drwnFactor &psi) | |
| copy constructor | |
| bool | empty () const |
| true if the factor contains no variables | |
| size_t | size () const |
| number of variables in this factor | |
| const drwnVarUniversePtr & | getUniverse () const |
| returns the variable universe | |
| drwnVarUniverse | getSubUniverse () const |
| returns the subset of the universe for this factor | |
| bool | hasVariable (int var) const |
| returns true if the variable is included in this factor | |
| int | varId (int indx) const |
| returns variable at given index | |
| int | varCard (int indx) const |
| return cardinality of variable at given index | |
| void | addVariable (const char *name) |
| add variable by name | |
| void | addVariables (const char *name,...) |
| add multiple variables | |
| void | addVariables (const vector< int > &c) |
| void | addVariables (const drwnClique &c) |
| void | addVariables (const drwnFactor &psi) |
| const vector< int > & | getOrderedVars () const |
| returns the ordered set of variables over which this factor is defined | |
| drwnClique | getClique () const |
| returns the set of variables over which this factor is defined | |
| double | getValueOf (const drwnPartialAssignment &y) const |
| Returns the value of the factor for a given partial assignment. The variables in the scope of this factor must be defined. | |
| void | setValueOf (const drwnPartialAssignment &y, double val) |
| Sets the value of the factor for a given partial assignment. The variables in the scope of this factor must be defined. | |
Public Member Functions inherited from drwnWriteable | |
| bool | write (const char *filename) const |
| write object to file (calls save) | |
| bool | read (const char *filename) |
| read object from file (calls load) | |
| void | dump () const |
| print object's current state to standard output (for debugging) | |
Protected Attributes | |
| std::vector< int > | _stride |
| stride of variable in table (by index) | |
| int | _nSize |
| total size of factor (or 1 for singular factors) | |
| double * | _data |
| data is stored as (a0, b0, ...), (a1, b0, ...), ... | |
| drwnTableFactorStorage * | _storage |
| pointer to shared storage (updates _data member) | |
Protected Attributes inherited from drwnFactor | |
| drwnVarUniversePtr | _pUniverse |
| all variables in the universe | |
| vector< int > | _variables |
| list of variables in factor (by index in factor) | |
| map< int, int > | _varIndex |
| index of variable in factor (by variable id) | |
Friends | |
| class | drwnTableFactorStorage |
Factor which stores the value of each assignment explicitly in table form.
Storage can be shared by using a drwnTableFactorStorage object. Operations on table factors should use the drwnFactorOperations objects.
1.8.13