@@ -275,28 +275,28 @@ void AllSTDPSynapses::advanceEdge(BGSIZE iEdg, AllVertices &neurons)
275275 // pre and post neurons index
276276 int idxPre = sourceVertexIndex_[iEdg];
277277 int idxPost = destVertexIndex_[iEdg];
278- uint64_t spikeHistory, spikeHistory2 ;
278+ uint64_t t_post, t_pre ;
279279 BGFLOAT delta;
280- BGFLOAT epre, epost;
280+
281+ // epre and epost are set to 1 for the independent model [Froemke and Dan (2002)]
282+ BGFLOAT epre = 1.0 ;
283+ BGFLOAT epost = 1.0 ;
281284
282285 if (fPre ) { // preSpikeHit
283- // spikeCount points to the next available position of spike_history,
284- // so the getSpikeHistory w/offset = -2 will return the spike time
285- // just one before the last spike.
286- spikeHistory = spNeurons.getSpikeHistory (idxPre, -2 );
287-
288- epre = 1.0 ;
289- epost = 1.0 ;
290- // call the learning function stdpLearning() for each pair of
291- // pre-post spikes
286+ // call the learning function stdpLearning() for each pair of pre-post spikes
292287 int offIndex = -1 ; // last spike
293288 while (true ) {
294- spikeHistory = spNeurons.getSpikeHistory (idxPost, offIndex);
295- if (spikeHistory == numeric_limits<unsigned long >::max ())
289+ // time of the offset post-spike hit
290+ t_post = spNeurons.getSpikeHistory (idxPost, offIndex);
291+
292+ // break if no post-spike is found
293+ if (t_post == numeric_limits<unsigned long >::max ())
296294 break ;
295+
297296 // delta is the spike interval between pre-post spikes
298- // (include pre-synaptic transmission delay)
299- delta = -static_cast <BGFLOAT>(g_simulationStep - spikeHistory) * deltaT;
297+ // deltaT converts the timestep to seconds
298+ delta = -static_cast <BGFLOAT>(g_simulationStep - t_post) * deltaT;
299+
300300 /*
301301 LOG4CPLUS_DEBUG(fileLogger_,"\nAllSTDPSynapses::advanceSynapse: fPre" << endl
302302 << "\tiEdg: " << iEdg << endl
@@ -320,28 +320,25 @@ void AllSTDPSynapses::advanceEdge(BGSIZE iEdg, AllVertices &neurons)
320320 }
321321
322322 if (fPost ) { // postSpikeHit
323- // spikeCount points to the next available position of spike_history,
324- // so the getSpikeHistory w/offset = -2 will return the spike time
325- // just one before the last spike.
326- spikeHistory = spNeurons.getSpikeHistory (idxPost, -2 );
327- epost = 1.0 ;
328- epre = 1 ;
329-
330-
331- // call the learning function stdpLearning() for each pair of
332- // post-pre spikes
323+ // call the learning function stdpLearning() for each pair of post-pre spikes
333324 int offIndex = -1 ; // last spike
334325 while (true ) {
335- spikeHistory = spNeurons.getSpikeHistory (idxPre, offIndex);
336- if (spikeHistory == numeric_limits<unsigned long >::max ())
326+ // time when the pre-spike left the source neuron
327+ t_pre = spNeurons.getSpikeHistory (idxPre, offIndex);
328+
329+ // break if no pre-spike is found
330+ if (t_pre == numeric_limits<unsigned long >::max ())
337331 break ;
338332
339- if (spikeHistory + total_delay > g_simulationStep) {
333+ // delay accounts for the time it takes the spike to reach the destination neuron
334+ if (t_pre + total_delay > g_simulationStep) {
340335 --offIndex;
341336 continue ;
342337 }
338+
343339 // delta is the spike interval between post-pre spikes
344- delta = static_cast <BGFLOAT>(g_simulationStep - spikeHistory - total_delay) * deltaT;
340+ delta = static_cast <BGFLOAT>(g_simulationStep - t_pre - total_delay) * deltaT;
341+
345342 /*
346343 LOG4CPLUS_DEBUG(fileLogger_,"\nAllSTDPSynapses::advanceSynapse: fPost" << endl
347344 << "\tiEdg: " << iEdg << endl
@@ -353,6 +350,7 @@ void AllSTDPSynapses::advanceEdge(BGSIZE iEdg, AllVertices &neurons)
353350 << "\tepost: " << epost << endl
354351 << "\tdelta: " << delta << endl << endl);
355352 */
353+
356354 if (delta >= 3.0 * taupos)
357355 break ;
358356
@@ -366,7 +364,6 @@ void AllSTDPSynapses::advanceEdge(BGSIZE iEdg, AllVertices &neurons)
366364 psr *= decay;
367365}
368366
369-
370367BGFLOAT AllSTDPSynapses::synapticWeightModification (BGSIZE iEdg, BGFLOAT synapticWeight,
371368 double delta)
372369{
@@ -379,15 +376,11 @@ BGFLOAT AllSTDPSynapses::synapticWeightModification(BGSIZE iEdg, BGFLOAT synapti
379376 BGFLOAT Apos = Apos_[iEdg];
380377 BGFLOAT Wex = Wex_[iEdg];
381378 BGFLOAT &W = W_[iEdg];
382- edgeType type = type_[iEdg];
383379 BGFLOAT dw = 0 ;
384- BGFLOAT oldW = W;
385-
386- // BGFLOAT modDelta = fabs(delta);
387380
381+ // muneg and mupos default to 0 for the basic multiplicative model
388382 if (delta < -STDPgap) {
389383 // depression
390-
391384 dw = pow (fabs (W) / Wex, muneg) * Aneg * exp (delta / tauneg); // normalize
392385 } else if (delta > STDPgap) {
393386 // potentiation
@@ -411,24 +404,17 @@ void AllSTDPSynapses::stdpLearning(BGSIZE iEdg, double delta, double epost, doub
411404 int srcVertex, int destVertex)
412405{
413406 BGFLOAT STDPgap = STDPgap_[iEdg];
414- BGFLOAT muneg = muneg_[iEdg];
415- BGFLOAT mupos = mupos_[iEdg];
416- BGFLOAT tauneg = tauneg_[iEdg];
417- BGFLOAT taupos = taupos_[iEdg];
418- BGFLOAT Aneg = Aneg_[iEdg];
419- BGFLOAT Apos = Apos_[iEdg];
420407 BGFLOAT Wex = Wex_[iEdg];
421408 BGFLOAT &W = W_[iEdg];
422409 edgeType type = type_[iEdg];
423410 BGFLOAT oldW = W;
424- // BGFLOAT modDelta = fabs(delta);
425411
426- if (delta <= fabs ( STDPgap) ) {
412+ if (fabs ( delta) <= STDPgap) {
427413 return ;
428414 }
429415
430416 // dw is the fractional change in synaptic strength; add 1.0 to become the scaling ratio
431- // dw = 1.0 + dw * epre * epost;
417+ // dw = 1.0 + dw * epre * epost; // used for the non-independent model
432418 BGFLOAT dw = 1.0 + synapticWeightModification (iEdg, W, delta);
433419
434420 // if scaling ratio is less than zero, set it to zero so this synapse, its
0 commit comments