Biorithm
1.1
|
Public Member Functions | |
MyGainState (StateType state, MyNT w=1) | |
virtual const MyGainState & | operator+= (const MyGainState &rhs) |
virtual const MyGainState & | operator* (MyNT weight) |
Multiply state by a constant and return the new value. | |
virtual bool | operator== (const MyGainState &rhs) const |
virtual bool | isEqual (const MyGainState &rhs) const |
virtual bool | isEqual (const MyGainState &rhs, MyNT epsilon) const |
MyNT | getWeight (StateType state) const |
StateType | collapse (MyNT threshold=0) |
ostream & | print (ostream &str) const |
void | _sanityCheck () const |
template<> | |
MyGainBiStateType | collapse (MyNT threshold) |
template<> | |
MyGainTriStateType | collapse (MyNT threshold) |
templated class that stores what states a node can be. For each legal state, MyGainState stores a real-valued weight corresponding to the "probability" or "confidence" we have that the node is in that state. An example of such a class is MyGainTriState; the legal states are 1, 0, or -1.
MyGainState< StateType >::MyGainState | ( | StateType | state, |
MyNT | w = 1 |
||
) | [inline] |
Initialise with a single state.
[in] | state,the | type of the state to initialise with. |
[in] | w,the | weight to assign to this state. |
The constructor assigns a weight of w to state and (implicitly) a weight of 0 to all other states.
MyGainBiStateType MyGainState< MyGainBiStateType >::collapse | ( | MyNT | threshold | ) |
When valid states are of the type MyGainBiStateType, MyGainState::collapse() works by taking the weighted sum of the states and selecting one of the valid states by comparing the sum to the threshold. The methods sets the weight of the selected state to be the sum.
MyGainTriStateType MyGainState< MyGainTriStateType >::collapse | ( | MyNT | threshold | ) |
When valid states are of the type MyGainTriStateType, MyGainState::collapse() works by taking the weighted sum of the states and selecting one of the valid states by comparing the sum to the threshold. The methods sets the weight of the selected state to be the sum.
StateType MyGainState< StateType >::collapse | ( | MyNT | threshold = 0 | ) |
"Collapse" the state into a single legal state. Return the legal state with the maximum weight.
[in] | threshold,ignored | for now. The default value is 0. |
MyNT MyGainState< StateType >::getWeight | ( | StateType | state | ) | const [inline] |
Return the weight of a legal state.
[in] | state,the | state for which the method should return the weight. |
virtual const MyGainState& MyGainState< StateType >::operator+= | ( | const MyGainState< StateType > & | rhs | ) | [inline, virtual] |
Add the argument to the invocant.
ostream& MyGainState< StateType >::print | ( | ostream & | str | ) | const [inline] |
Print details of the state.