📄 basicneuron.h
字号:
/*************************************************************************** basicneuron.h - description ------------------- copyright : (C) 2000, 2001, 2002 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. * * * ***************************************************************************//*************************************************************************** This is a default implementation of a Neuron to be used if the Neuron class is turned into an abstract base class. This does nothing at this time.***************************************************************************/#ifndef BASICNEURON_H#define BASICNEURON_H#include <amygdala/neuron.h>/** @class BasicNeuron basicneuron.h amygdala/basicneuron.h * @brief BasicNeuron implements a simple integrate-and-fire * neuron model based on the model presented in chapter 1 * of Pulsed Neural Networks, but with the membrane time constant * set to 0. * * The BasicNeuron PSP is modeled as * \f[ U = \left( \frac{t}{\tau_s^2} \right) * exp\left( \frac{-t}{\tau_s} \right) \f] * @see Neuron, AlphaNeuron, FastNeuron * @author Matt Grover */class BasicNeuron : public Neuron {public: BasicNeuron(AmIdInt neuronId); virtual ~BasicNeuron(); /** Fill a lookup table and return * a pointer to the first element. Neuron::SetTableDimensions() * should be called first. * This is an internal function and should only be called * by FunctionLookup. This function will be made private or removed * completely for Amygdala 0.4. * @param index The index of the table to be initialized. * @return A pointer to the lookup table (an array of floats). */ virtual float* InitializeLookupTable(int index); /** This is an internal function and should only be called * by FunctionLookup. This function will be either removed * or made private for Amygdala 0.4. * @return An array containing any values used to generate * the lookup tables that were set at runtime. * @param index * @param numParams Number of unique parameters (variables) needed * to generate the lookup table associated with index. */ virtual float* GetTableParams(int index, int& numParams); /** return "BasicNeuron". this is needed for xml tags. */ virtual const char* ClassId() { return "BasicNeuron"; }protected: // Functions: /** Send a spike to this Neuron. When spikes are * grouped, this function will only be called once per step, but * it can be called multiple times otherwise. * This should only be called from other Neurons or the Network. * @param inSynapse The synapses that the incoming spikes are crossing. * (locations of the weights). * @param inTime Time of input (microseconds). * @param numSyn Number of synapses that are receiving * input during the current time step. The default value * of 0 indicates that spikes are not being grouped together * and only a single spike is being passed. * @see Neuron::SendSpike(), Network::SendDelayedSpikes(). */ virtual void InputSpike(SynapseItr& inSynapse, AmTimeInt inTime, unsigned int numSyn = 0); /** Query funcRef to see if a lookup table has already * been generated for an identical neuron and retrieve * a pointer to the table if it has. * This is an internal function and should not be called * by library users. * @param funcRef Pointer to a FunctionLookup object. */ virtual int SetLookupTables(FunctionLookup* funcRef); /** Fill the lookup table corresponding to index. * Two tables are used in this class -- a PostSynaptic potential * table and a table holding values for the derivative of the * potential. * @param index Index number of table to be populated. */ virtual int FillLookupTables(int index); /** Determine the maximum value of a weight for this neuron and * set maxScaledWeight to this value. This will be used * as the multiplication factor to convert to and from the * normalized weight values that are used in the public * interface. * <P>NOTE: This function will be deprecated in version 0.4 * if favor of normalizing PSP curves rather than recalculating * normalized weights. */ virtual void SetMaxScaledWeight();private: /** Calculate the value of the PSP function and derivative * for a given time. calcTime is relative to the arrival * of a spike and is in microseconds. * @param calcTime Time from the last input to this neuron. * @param pspElement Pointer to the calculated value. */ inline void PspKernel(float calcTime, float* pspElement); /** Find the derivative of PspKernel * @param calcTime Time from the last input to this neuron. * @param dPspElement Pointer to the calculated value. */ inline void DPspKernel(float calcTime, float* dPspElement); /** Calculate the current membrane potential of the neuron * based on the history of inputs since the last output * spike. Called from InputSpike. * @param state Current state of the neuron (return value). * @param deriv Derivative of current state (return value). * @param calceTime Time used for the calculation. * @param historySize historySize Number of history elements to * include in the calculatiom. */ inline void CalcState(float& state, float& deriv, const AmTimeInt& calcTime, const AmTimeInt& historySize); /* * Tables used to cache value of PSP function and its derivative * for each time step (number of steps cached is specified by * pspLSize) */ float* pspLookup; float* dPspLookup; friend class Network;};#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -