GeNN
4.9.0
GPU enhanced Neuronal Networks (GeNN)
|
#include <initSparseConnectivitySnippet.h>
Public Member Functions | |
DECLARE_SNIPPET (InitSparseConnectivitySnippet::FixedProbabilityNoAutapse, 1) | |
SET_ROW_BUILD_CODE ("int nextJ;\ "do {\" " const scalar u=$(gennrand_uniform);\" " nextJ=prevJ+(1+(int)(log(u) *$(probLogRecip)));\" "} while(nextJ==$(id_pre));\" "prevJ=nextJ;\" "if(prevJ< $(num_post)) {\" " $(addSynapse, prevJ+$(id_post_begin));\" "}\" "else {\" " $(endRow);\" "}\") | |
Public Member Functions inherited from InitSparseConnectivitySnippet::FixedProbabilityBase | |
virtual std::string | getRowBuildCode () const override=0 |
SET_ROW_BUILD_STATE_VARS ({{"prevJ", "int", -1}}) | |
virtual StringVec | getParamNames () const override |
Gets names of of (independent) model parameters. More... | |
virtual DerivedParamVec | getDerivedParams () const override |
SET_CALC_MAX_ROW_LENGTH_FUNC ([](unsigned int numPre, unsigned int numPost, const std::vector< double > &pars) { const double quantile=pow(0.9999, 1.0/(double) numPre);return binomialInverseCDF(quantile, numPost, pars[0]);}) | |
SET_CALC_MAX_COL_LENGTH_FUNC ([](unsigned int numPre, unsigned int numPost, const std::vector< double > &pars) { const double quantile=pow(0.9999, 1.0/(double) numPost);return binomialInverseCDF(quantile, numPre, pars[0]);}) | |
Public Member Functions inherited from InitSparseConnectivitySnippet::Base | |
virtual ParamValVec | getRowBuildStateVars () const |
virtual std::string | getColBuildCode () const |
virtual ParamValVec | getColBuildStateVars () const |
virtual std::string | getHostInitCode () const |
virtual CalcMaxLengthFunc | getCalcMaxRowLengthFunc () const |
Get function to calculate the maximum row length of this connector based on the parameters and the size of the pre and postsynaptic population. More... | |
virtual CalcMaxLengthFunc | getCalcMaxColLengthFunc () const |
Get function to calculate the maximum column length of this connector based on the parameters and the size of the pre and postsynaptic population. More... | |
virtual CalcKernelSizeFunc | getCalcKernelSizeFunc () const |
Get function to calculate kernel size required for this conenctor based on its parameters. More... | |
boost::uuids::detail::sha1::digest_type | getHashDigest () const |
Update hash from snippet. More... | |
void | validate () const |
Validate names of parameters etc. More... | |
Public Member Functions inherited from Snippet::Base | |
virtual | ~Base () |
virtual EGPVec | getExtraGlobalParams () const |
size_t | getExtraGlobalParamIndex (const std::string ¶mName) const |
Find the index of a named extra global parameter. More... | |
Additional Inherited Members | |
Public Types inherited from InitSparseConnectivitySnippet::Base | |
typedef std::function< unsigned int(unsigned int, unsigned int, const std::vector< double > &)> | CalcMaxLengthFunc |
typedef std::function< std::vector< unsigned int >const std::vector< double > &)> | CalcKernelSizeFunc |
Public Types inherited from Snippet::Base | |
typedef std::vector< std::string > | StringVec |
typedef std::vector< EGP > | EGPVec |
typedef std::vector< ParamVal > | ParamValVec |
typedef std::vector< DerivedParam > | DerivedParamVec |
Protected Member Functions inherited from Snippet::Base | |
void | updateHash (boost::uuids::detail::sha1 &hash) const |
void | validate () const |
Validate names of parameters etc. More... | |
Static Protected Member Functions inherited from Snippet::Base | |
template<typename T > | |
static size_t | getNamedVecIndex (const std::string &name, const std::vector< T > &vec) |
Initialises connectivity with a fixed probability of a synapse existing between a pair of pre and postsynaptic neurons. This version ensures there are no autapses - connections between neurons with the same id so should be used for recurrent connections.
Whether a synapse exists between a pair of pre and a postsynaptic neurons can be modelled using a Bernoulli distribution. While this COULD br sampling directly by repeatedly drawing from the uniform distribution, this is innefficient. Instead we sample from the gemetric distribution which describes "the probability distribution of the number of Bernoulli trials needed to get one success" – essentially the distribution of the 'gaps' between synapses. We do this using the "inversion method" described by Devroye (1986) – essentially inverting the CDF of the equivalent continuous distribution (in this case the exponential distribution)
InitSparseConnectivitySnippet::FixedProbabilityNoAutapse::DECLARE_SNIPPET | ( | InitSparseConnectivitySnippet::FixedProbabilityNoAutapse | , |
1 | |||
) |
InitSparseConnectivitySnippet::FixedProbabilityNoAutapse::SET_ROW_BUILD_CODE | ( | ) |