CARLsim
6.1.0
CARLsim: a GPU-accelerated SNN simulator
|
Class for generating Poisson spike trains. More...
#include <poisson_rate.h>
Classes | |
class | Impl |
Public Member Functions | |
PoissonRate (int nNeur, bool onGPU=false) | |
PoissonRate constructor. More... | |
~PoissonRate () | |
PoissonRate destructor. More... | |
int | getNumNeurons () |
Returns the number of neurons for which to generate Poisson spike trains. More... | |
float | getRate (int neurId) |
Returns the mean firing rate of a specific neuron ID. More... | |
float * | getRatePtrCPU () |
Returns pointer to CPU-allocated firing rate array (deprecated) More... | |
float * | getRatePtrGPU () |
Returns pointer to GPU-allocated firing rate array (deprecated) More... | |
std::vector< float > | getRates () |
Returns a vector of firing rates, one element per neuron. More... | |
bool | isOnGPU () |
Checks whether the firing rates are allocated on CPU or GPU. More... | |
void | setRate (int neurId, float rate) |
Sets the mean firing rate of a particular neuron ID. More... | |
void | setRates (float rate) |
Assigns the same mean firing rate to all neurons. More... | |
void | setRates (const std::vector< float > &rates) |
Sets the mean firing rate of each neuron from a vector. More... | |
The PoissonRate class allows a user create spike trains whose inter-spike interval follows a Poisson process. The object can then be linked to a spike generator group (created via CARLsim::createSpikeGeneratorGroup) by calling CARLsim::setSpikeRate.
All firing rates will be initialized to zero. The user then has a number of options to manipulate the mean firing rate of each neuron. The same rate can be applied to all neurons by calling PoissonRate::setRates(float rate). Individual rates can be applied from a vector by calling PoissonRate::setRates(const std::vector<float>& rates). The rate of a single neuron can be manipulated by calling PoissonRate::setRate(int neurId, float rate).
Example usage:
Definition at line 88 of file poisson_rate.h.
PoissonRate | ( | int | nNeur, |
bool | onGPU = false |
||
) |
Creates a new instance of class PoissonRate.
[in] | nNeur | the number of neurons for which to generate Poisson spike trains |
[in] | onGPU | whether to allocate the rate vector on GPU (true) or CPU (false) |
Definition at line 227 of file poisson_rate.cpp.
~PoissonRate | ( | ) |
Cleans up all the memory upon object deletion.
Definition at line 228 of file poisson_rate.cpp.
int getNumNeurons | ( | ) |
This function returns the number of neurons for which to generate Poisson spike trains. This number is defined at initialization and cannot be changed during the object lifetime.
Definition at line 230 of file poisson_rate.cpp.
float getRate | ( | int | neurId | ) |
This function returns the mean firing rate assigned to a specific neuron ID. The neuron ID is 0-indexed and should thus be in the range [ 0 , getNumNeurons() ). It is completely independent from CARLsim neuron IDs.
[in] | neurId | the neuron ID (0-indexed) |
Definition at line 231 of file poisson_rate.cpp.
float * getRatePtrCPU | ( | ) |
This function returns a pointer to the underlying firing rate array if allocated on the CPU. This pointer does not exist when the PoissonRate object is allocated on GPU.
Definition at line 233 of file poisson_rate.cpp.
float * getRatePtrGPU | ( | ) |
This function returns a pointer to the underlying firing rate array if allocated on the GPU. This pointer does not exist when the PoissonRate object is allocated on CPU.
Definition at line 234 of file poisson_rate.cpp.
std::vector< float > getRates | ( | ) |
This function returns all the mean firing rates in a vector, one vector element per neuron.
Definition at line 232 of file poisson_rate.cpp.
bool isOnGPU | ( | ) |
This function checks whether the firing rates are allocated either on CPU or GPU.
Definition at line 235 of file poisson_rate.cpp.
void setRate | ( | int | neurId, |
float | rate | ||
) |
This function sets the firing rate of a particular neuron ID. The neuron ID is 0-indexed and should thus be in the range [ 0 , getNumNeurons() ). It is completely independent from CARLsim neuron IDs.
[in] | neurId | the neuron ID (0-indexed) |
[in] | rate | the firing rate to set |
Definition at line 236 of file poisson_rate.cpp.
void setRates | ( | float | rate | ) |
This function assigns the same firing rate to all the neurons.
[in] | rate | the firing rate to set |
Definition at line 237 of file poisson_rate.cpp.
void setRates | ( | const std::vector< float > & | rates | ) |
This function sets the firing rate of each neuron from a vector of firing rates, one rate per neuron.
[in] | rates | vector of firing rates (size should be equivalent to PoissonRate::getNumNeurons()) |
Definition at line 238 of file poisson_rate.cpp.