22 template <
class DATATYPE>
    26     for (
int i = 0; i < sz; i++) {
    27         if (abs(Array[i]) > includeAbove) count++;
    29     fprintf(stdout, 
"\nCounted %u nonzero entries\n\n", count);
    43 template <
class DATATYPE>
    46     fprintf(stderr,
"WARNING: This function is deprecated, and if you are still using it \n\    47   you are probably trying to use the old sparse structures containing the g array.  \n\    48   Conductance structures have changed: conductance values should be defined as synapse variables now; \n\    49   the structure is renamed as \"SparseProjection\" and contains only indexing arrays. \n\n\    50   The replacement function for getG is \n\    51   getSparseVar(DATATYPE * wuvar, SparseProjection  * sparseStruct, int x, int y).\n\n\    52   calling getSparseVar...");
    56 template <
class DATATYPE>
    60     int startSynapse = sparseStruct->
indInG[x];
    61     int endSynapse = sparseStruct->
indInG[x+1];
    62     for (
int syn = startSynapse; syn < endSynapse; syn++) {
    63         if (sparseStruct->
ind[syn]==y) {
    78 template <
class DATATYPE>
    82     sparseStruct->
indInG[0] = 0; 
    83     for (
int pre = 0; pre < preN; ++pre) {
    84         for (
int post = 0; post < postN; ++post) {
    85             DATATYPE g = tmp_gRNPN[pre * postN + post];
    87                 sparseStruct->
ind[synapse] = post;
    92         sparseStruct->
indInG[pre + 1] = synapse; 
   104 template <
class DATATYPE>
   111     sparseStruct->
indInG[0] = 0; 
   112     for (
int pre = 0; pre < preN; ++pre) {
   113         for (
int post = 0; post < postN; ++post) {
   114             DATATYPE g = tmp_gRNPN[pre * postN + post];
   116                 sparseStruct->
ind[synapse] = post;
   121         sparseStruct->
indInG[pre + 1] = synapse; 
   123     if (!runTest) 
return;
   127     for (
int test = 0; test < 10; ++test) {
   128         int randX = rand() % preN;
   129         int randY = rand() % postN;
   130         float denseResult = tmp_gRNPN[randX * postN + randY];
   131         float sparseResult = 
getG(wuvar, sparseStruct,randX,randY);
   135         fprintf(stderr, 
"ERROR: Sparse connectivity generator failed for %u out of 10 random checks.\n", fails);
   138     fprintf(stdout, 
"Sparse connectivity generator passed %u out of 10 random checks.\n", fails);
 DATATYPE getG(DATATYPE *wuvar, SparseProjection *sparseStruct, int x, int y)
DEPRECATED Utility to get a synapse weight from a SPARSE structure by x,y coordinates NB: as the Spar...
Definition: sparseUtils.h:44
 
void createPosttoPreArray(unsigned int preN, unsigned int postN, SparseProjection *C)
Utility to generate the SPARSE array structure with post-to-pre arrangement from the original pre-to-...
Definition: sparseUtils.cc:16
 
void createSparseConnectivityFromDense(DATATYPE *wuvar, int preN, int postN, DATATYPE *tmp_gRNPN, SparseProjection *sparseStruct, bool runTest)
Utility to generate the SPARSE connectivity structure from a simple all-to-all array. 
Definition: sparseUtils.h:105
 
Global header file containing a few global variables. Part of the code generation section...
 
double asGoodAsZero
Global variable that is used when detecting close to zero values, for example when setting sparse con...
Definition: global.cc:40
 
unsigned int countEntriesAbove(DATATYPE *Array, int sz, double includeAbove)
Utility to count how many entries above a specified value exist in a float array. ...
Definition: sparseUtils.h:23
 
unsigned int connN
Definition: sparseProjection.h:25
 
void initializeSparseArrayRev(SparseProjection C, unsigned int *dRevInd, unsigned int *dRevIndInG, unsigned int *dRemap, unsigned int postN)
Function for initializing reversed conductance array indices for sparse matrices on the GPU (by copyi...
Definition: sparseUtils.cc:80
 
unsigned int * ind
Definition: sparseProjection.h:20
 
float getSparseVar(DATATYPE *wuvar, SparseProjection *sparseStruct, int x, int y)
Definition: sparseUtils.h:57
 
void setSparseConnectivityFromDense(DATATYPE *wuvar, int preN, int postN, DATATYPE *tmp_gRNPN, SparseProjection *sparseStruct)
Function for setting the values of SPARSE connectivity matrix. 
Definition: sparseUtils.h:79
 
unsigned int * indInG
Definition: sparseProjection.h:19
 
void createPreIndices(unsigned int preN, unsigned int postN, SparseProjection *C)
Function to create the mapping from the normal index array "ind" to the "reverse" array revInd...
Definition: sparseUtils.cc:48
 
class (struct) for defining a spars connectivity projection 
Definition: sparseProjection.h:18
 
void initializeSparseArray(SparseProjection C, unsigned int *dInd, unsigned int *dIndInG, unsigned int preN)
Function for initializing conductance array indices for sparse matrices on the GPU (by copying the va...
Definition: sparseUtils.cc:67
 
void initializeSparseArrayPreInd(SparseProjection C, unsigned int *dPreInd)
Function for initializing reversed conductance arrays presynaptic indices for sparse matrices on the ...
Definition: sparseUtils.cc:94