Struct Spike

Struct Documentation

struct Spike

Spike event. Spikes are fired and received by spiking neurons. They drive the computation during inference.

Public Functions

Spike() = default

Default constructor.

Spike(unsigned int index, float time)

Constructs a spike with a given index and timing.

Parameters
  • index – The index of the neuron that fired the spike.

  • time – The timing of the spike.

bool operator==(const Spike &rhs) const

Checks if two spikes occured within a time distance of Spike::epsilon, i.e. std::abs(this->time - rhs.time) < epsilon.

Parameters

rhs – The other spike to compare.

Returns

True if the absolute difference between the two spike timings is bellow Spike::epsilon.

bool operator!=(const Spike &rhs) const

Checks if two spikes did not occur within a time distance of Spike::epsilon, i.e. std::abs(this->time - rhs.time) >= epsilon.

Parameters

rhs – The other spike to compare.

Returns

True if the absolute difference between the two spike timings is above Spike::epsilon.

bool operator<(const Spike &rhs) const

Checks if the spike occured before a given spike, i.e. this->time < rhs.time.

Parameters

rhs – The other spike to compare.

Returns

True if the spike occured before rhs.

bool operator<=(const Spike &rhs) const

Checks if the spike occured before or at the same time as given spike, i.e. this->time <= rhs.time.

Parameters

rhs – The other spike to compare.

Returns

True if the spike occured before or at the same time as rhs.

bool operator>(const Spike &rhs) const

Checks if the spike occured after a given spike, i.e. this->time > rhs.time.

Parameters

rhs – The other spike to compare.

Returns

True if the spike occured after rhs.

bool operator>=(const Spike &rhs) const

Checks if the spike occured after or at the same time as given spike, i.e. this->time >= rhs.time.

Parameters

rhs – The other spike to compare.

Returns

True If the spike occured after or at the same time as rhs.

Public Members

unsigned int index

Index (in the layer) of the neuron that fired the spike.

float time

Timing of the spike.

Public Static Attributes

static constexpr float epsilon = 1e-6

Time difference within two spikes are considered equal.

Friends

friend std::ostream &operator<<(std::ostream &os, const Spike &spike)

Formats the spike to the given output stream.

Parameters
  • os – The output stream to write.

  • spike – The spike to format.

Returns

the Output stream os.