📄 dendrite.h
字号:
/*************************************************************************** dendrite.h - description ------------------- begin : Fri Jun 20 2003 copyright : (C) 2003 by Matt Grover email : mgrover@amygdala.org ***************************************************************************//*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/#ifndef DENDRITE_H#define DENDRITE_H#include <amygdala/amygdalaclass.h>#include <vector>#include <string>namespace Amygdala {class SpikingNeuron;class Synapse;class Trainer;struct SynapseHist { AmTimeInt time; Synapse* syn;};/** @class Dendrite dendrite.h amygdala/dendrite.h * Connecting object to attach synapses to a postsynaptic neuron * and to hold data that is common to all synapses associated with a * particular neuron, such as the aggregated weight for all synapses * that transmitted spikes during a time step. * @author Matt Grover <mgrover@amygdala.org> */class Dendrite: public AmygdalaClass { friend class SpikingNeuron;public: virtual ~Dendrite(); /** Get the total stimulation to the neuron due to all spikes * that were transmitted across this neuron's synapses. In the * case of a static synapse model, this will be a simple summation. * Other models, such as dynamic synapses, may use more complicated processing. */ void GetStimulationLevel(float& posTotal, float& negTotal); /** Turn training on or off. */ void SetTrainingState(bool state) { isTraining = state; } /** Determine if the dendrite is currently in training mode. */ bool GetTrainingState() const { return isTraining; } void SetTrainer(Trainer* t); inline void AddToTotal(float& weight); /** @return Flag indicating if a spike processing trigger has * been set in Network. If the trigger has been set, then * the Neuron's ProcessInput() function will be called. The trigger * should only be set once in a time step. */ const bool& TriggerIsSet() const { return nrnTriggerSet; } /** Reset the state of the trigger to false */ void ResetTrigger() { nrnTriggerSet=false; } /** Set a trigger in Network that will cause SpikingNeuron::ProcessInput() * to be called after all delayed spikes have been sent. */ void SetNrnTrigger(); void ReportSpike(); /** @return Ptr to the post-synaptic neuron */ SpikingNeuron* GetPostNeuron() const { return postNrn; } Trainer* GetTrainer() const { return trainer; }protected: /** Build a dendrite for neuron postSynapticNrn */ Dendrite(SpikingNeuron* postSynapticNrn); float totalWeightPos; float totalWeightNeg; SpikingNeuron* postNrn; Trainer* trainer; bool nrnTriggerSet; bool isTraining;private:};/** @class StaticDendrite dendrite.h amygdala/dendrite.h * @brief A dendrite for use with StaticSynapse * @see Dendrite, StaticSynapse *//*class StaticDendrite: public Dendrite {public: virtual ~StaticDendrite() {}; virtual void SetTrainer(Trainer* t); void SetTrainer(StaticTrainer* st) { trainer=st; } StaticTrainer* GetTrainer() const { return trainer; } virtual void ReportSpike();protected: StaticDendrite(SpikingNeuron* postSynapticNrn); StaticTrainer* trainer; friend class StaticSynapse; friend class DynamicSynapse;};*//** @class DynamicDendrite dendrite.h amygdala/dendrite.h * @brief A dendrite for use with DynamicSynapse * @see Dendrite, DynamicSynapse *//*class DynamicDendrite: public Dendrite {public: virtual ~DynamicDendrite() {}; virtual void SetTrainer(Trainer* t) {} virtual void ReportSpike();protected: DynamicDendrite(SpikingNeuron* postSynapticNrn); friend class DynamicSynapse;};*/inline void Dendrite::AddToTotal(float& weight){ if (weight>0.0) { totalWeightPos += weight; } else { totalWeightNeg += weight; }}} // namespace Amygdala#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -