Biorithm  1.1
Public Member Functions
MyGainState< StateType > Class Template Reference

List of all members.

Public Member Functions

 MyGainState (StateType state, MyNT w=1)
virtual const MyGainStateoperator+= (const MyGainState &rhs)
virtual const MyGainStateoperator* (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)

Detailed Description

template<typename StateType>
class MyGainState< StateType >

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.


Constructor & Destructor Documentation

template<typename StateType >
MyGainState< StateType >::MyGainState ( StateType  state,
MyNT  w = 1 
) [inline]

Initialise with a single state.

Parameters:
[in]state,thetype of the state to initialise with.
[in]w,theweight to assign to this state.

The constructor assigns a weight of w to state and (implicitly) a weight of 0 to all other states.


Member Function Documentation

template<>
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.

template<>
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.

template<typename StateType >
StateType MyGainState< StateType >::collapse ( MyNT  threshold = 0)

"Collapse" the state into a single legal state. Return the legal state with the maximum weight.

Parameters:
[in]threshold,ignoredfor now. The default value is 0.
Note:
The name of this method comes from the analogy of a quantum
template<typename StateType >
MyNT MyGainState< StateType >::getWeight ( StateType  state) const [inline]

Return the weight of a legal state.

Parameters:
[in]state,thestate for which the method should return the weight.
template<typename StateType >
virtual const MyGainState& MyGainState< StateType >::operator+= ( const MyGainState< StateType > &  rhs) [inline, virtual]

Add the argument to the invocant.

template<typename StateType >
ostream& MyGainState< StateType >::print ( ostream &  str) const [inline]

Print details of the state.


The documentation for this class was generated from the following file:
 All Classes Functions Variables Typedefs Friends