spikeinput.cpp

来自「amygdata的神经网络算法源代码」· C++ 代码 · 共 69 行

CPP
69
字号
/***************************************************************************                          spikeinput.cpp  -  description                             -------------------    begin                : Wed Aug 8 2001    copyright            : (C) 2001 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.                                   * *                                                                         * ***************************************************************************/using namespace std;#include <stdexcept>#include "spikeinput.h"#include "network.h"#include "inputneuron.h"using namespace Amygdala;using namespace std;;SpikeInput::SpikeInput(): NeuronGroup(){    simStepSize = Network::GetNetworkRef()->TimeStepSize();}SpikeInput::SpikeInput(const string& name): NeuronGroup(name){    simStepSize = Network::GetNetworkRef()->TimeStepSize();}SpikeInput::~SpikeInput(){}void SpikeInput::ScheduleQueuedSpikes(){    unsigned int i;//    sort(inputSpike.begin(), inputSpike.end());    for (i=0; i<inputSpike.size(); i++) {        Network::GetNetworkRef()->ScheduleSpike(inputSpike[i].spikeTime,                            inputSpike[i].inNeuron);    }    inputSpike.clear();}void SpikeInput::AddNeuron(InputNeuron* iNeuron){    Neuron * nrn = static_cast <Neuron *> (iNeuron);    NeuronGroup::AddNeuron(nrn);}void SpikeInput::AddNeuron(Neuron* nrn){    InputNeuron * iNeuron = dynamic_cast<InputNeuron*>(nrn);    if(iNeuron == NULL) throw runtime_error("Cannot add neuron because it's no InputNeuron");    AddNeuron(dynamic_cast<InputNeuron*>(nrn));}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?