c++ - how to update a leaky integrate and fire neuron -
i'm trying implement leaky integrate , fire neuron in c++, can't figure out , efficient way update neuron's voltage when new current arrives.
i using code write now, new field , don't think optimal solution. right way update neuron?
void lif_neuron::update(double current, size_t time){ //update current //formula: (v_current - v_reset)*(1-exp((t_last_fired - t_now)/rc)) + r*i mcurrentvolt += -1*(mcurrentvolt-mresetvolt)*(1-exp((mlasttimefired-time)/mrc)) + mr*current; //all leakage since last activation substracted, give substracted in earlier updates mcurrentvolt += (mcurrentvolt-mresetvolt)*(1-exp((mlasttimefired-mlasttimeupdated)/mrc)); if(mcurrentvolt >= mthreshold){ mfires = true; mlasttimefired = time; }else{ mfires = false; } mlasttimeupdated = time; }
mrc
, mr
constants of neuron.
Comments
Post a Comment