76 Cluster(
unsigned int numNeurons, QString name =
"unnamed" );
103 virtual void randomize(
double min,
double max ) = 0;
107 void setInput(
unsigned int neuron,
double value );
109 void setInputs(
const DoubleVector& inputs );
113 void setAllInputs(
double value );
120 double getInput(
unsigned int neuron )
const;
130 void setOutput(
unsigned int neuron,
double value );
132 void setOutputs(
const DoubleVector& outputs );
134 double getOutput(
unsigned int neuron )
const;
150 return updater.get();
162 static void describe( QString type );
175 typedef DoubleVector& (*getStateVectorFuncPtr)(
Cluster* );
183 if ( stateDelegates.contains( stateVector ) ) {
184 return stateDelegates[stateVector];
186 throw ClusterStateVectorNotPresent( (QString(
"The state vector named ") + stateVector +
" is not part of this Cluster").toLatin1().data() );
203 template <
class T, DoubleVector& (T::*TMethod)()>
205 stateDelegates[vectorName] = &staticDelegateMethod<T, TMethod>;
211 needRst = accOff && b;
215 unsigned int numneurons;
217 DoubleVector inputdata;
219 DoubleVector outputdata;
221 std::auto_ptr<OutputFunction> updater;
230 QMap<QString, getStateVectorFuncPtr> stateDelegates;
232 template <
class T, DoubleVector& (T::*TMethod)()>
233 static DoubleVector& staticDelegateMethod(
Cluster* cluster_ptr ) {
234 T* p =
static_cast<T*
>(cluster_ptr);
236 return (p->*TMethod)();