18 #define SET_ROW_BUILD_CODE(CODE) virtual std::string getRowBuildCode() const override{ return CODE; } 19 #define SET_ROW_BUILD_STATE_VARS(...) virtual NameTypeValVec getRowBuildStateVars() const override{ return __VA_ARGS__; } 21 #define SET_CALC_MAX_ROW_LENGTH_FUNC(FUNC) virtual CalcMaxLengthFunc getCalcMaxRowLengthFunc() const override{ return FUNC; } 22 #define SET_CALC_MAX_COL_LENGTH_FUNC(FUNC) virtual CalcMaxLengthFunc getCalcMaxColLengthFunc() const override{ return FUNC; } 24 #define SET_EXTRA_GLOBAL_PARAMS(...) virtual StringPairVec getExtraGlobalParams() const override{ return __VA_ARGS__; } 38 typedef std::function<unsigned int(unsigned int, unsigned int, const std::vector<double> &)>
CalcMaxLengthFunc;
63 Init(
const Base *snippet,
const std::vector<double> ¶ms)
89 "$(addSynapse, $(id_pre));\n" 93 [](
unsigned int numPre,
unsigned int numPost,
const std::vector<double> &)
95 assert(numPre == numPost);
99 [](
unsigned int numPre,
unsigned int numPost,
const std::vector<double> &)
101 assert(numPre == numPost);
119 SET_DERIVED_PARAMS({{
"probLogRecip", [](
const std::vector<double> &pars, double){
return 1.0 / log(1.0 - pars[0]); }}});
122 [](
unsigned int numPre,
unsigned int numPost,
const std::vector<double> &pars)
125 const double quantile = pow(0.9999, 1.0 / (
double)numPre);
130 [](
unsigned int numPre,
unsigned int numPost,
const std::vector<double> &pars)
133 const double quantile = pow(0.9999, 1.0 / (
double)numPost);
159 "const scalar u = $(gennrand_uniform);\n" 160 "prevJ += (1 + (int)(log(u) * $(probLogRecip)));\n" 161 "if(prevJ < $(num_post)) {\n" 162 " $(addSynapse, prevJ);\n" 193 " const scalar u = $(gennrand_uniform);\n" 194 " nextJ = prevJ + (1 + (int)(log(u) * $(probLogRecip)));\n" 195 "} while(nextJ == $(id_pre));\n" 197 "if(prevJ < $(num_post)) {\n" 198 " $(addSynapse, prevJ);\n" virtual StringPairVec getExtraGlobalParams() const
Definition: initSparseConnectivitySnippet.h:54
virtual CalcMaxLengthFunc getCalcMaxColLengthFunc() const
Get function to calculate the maximum column length of this connector based on the parameters and the...
Definition: initSparseConnectivitySnippet.h:50
unsigned int binomialInverseCDF(double cdf, unsigned int n, double p)
Definition: binomial.cc:106
Definition: initSparseConnectivitySnippet.h:60
Definition: snippet.h:139
std::vector< std::pair< std::string, std::pair< std::string, double > > > NameTypeValVec
Definition: snippet.h:118
virtual CalcMaxLengthFunc getCalcMaxRowLengthFunc() const
Get function to calculate the maximum row length of this connector based on the parameters and the si...
Definition: initSparseConnectivitySnippet.h:47
#define SET_ROW_BUILD_STATE_VARS(...)
Definition: initSparseConnectivitySnippet.h:19
#define DECLARE_SNIPPET(TYPE, NUM_PARAMS)
Definition: snippet.h:11
#define SET_CALC_MAX_COL_LENGTH_FUNC(FUNC)
Definition: initSparseConnectivitySnippet.h:22
Definition: initSparseConnectivitySnippet.h:32
virtual NameTypeValVec getRowBuildStateVars() const
Definition: initSparseConnectivitySnippet.h:44
Base class for all sparse connectivity initialisation snippets.
Definition: initSparseConnectivitySnippet.h:30
#define SET_DERIVED_PARAMS(...)
Definition: snippet.h:29
Initialises connectivity to a 'one-to-one' diagonal matrix.
Definition: initSparseConnectivitySnippet.h:83
virtual std::string getRowBuildCode() const
Definition: initSparseConnectivitySnippet.h:43
std::function< unsigned int(unsigned int, unsigned int, const std::vector< double > &)> CalcMaxLengthFunc
Definition: initSparseConnectivitySnippet.h:38
#define SET_ROW_BUILD_CODE(CODE)
Definition: initSparseConnectivitySnippet.h:18
Used to mark connectivity as uninitialised - no initialisation code will be run.
Definition: initSparseConnectivitySnippet.h:73
Definition: initSparseConnectivitySnippet.h:153
Base class for all code snippets.
Definition: snippet.h:105
#define SET_PARAM_NAMES(...)
Definition: snippet.h:28
Init(const Base *snippet, const std::vector< double > ¶ms)
Definition: initSparseConnectivitySnippet.h:63
std::vector< std::pair< std::string, std::string > > StringPairVec
Definition: snippet.h:117
#define SET_CALC_MAX_ROW_LENGTH_FUNC(FUNC)
Definition: initSparseConnectivitySnippet.h:21
Definition: initSparseConnectivitySnippet.h:111
Definition: initSparseConnectivitySnippet.h:185