GeNN  3.3.0
GPU enhanced Neuronal Networks (GeNN)
sparseUtils.h File Reference
#include <string>
#include <cmath>
#include <cstdlib>
#include <cstdio>
#include "global.h"
#include "sparseProjection.h"

Go to the source code of this file.

Functions

template<class DATATYPE >
unsigned int countEntriesAbove (DATATYPE *Array, int sz, double includeAbove)
 Utility to count how many entries above a specified value exist in a float array. More...
 
template<class DATATYPE >
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 SparseProjection struct doesnt hold the preN size (it should!) it is not possible to check the parameter validity. This fn may therefore crash unless user knows max poss X. More...
 
template<class DATATYPE >
float getSparseVar (DATATYPE *wuvar, SparseProjection *sparseStruct, unsigned int x, unsigned int y)
 
template<class DATATYPE >
void setSparseConnectivityFromDense (DATATYPE *wuvar, int preN, int postN, DATATYPE *tmp_gRNPN, SparseProjection *sparseStruct)
 Function for setting the values of SPARSE connectivity matrix. More...
 
template<class DATATYPE >
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. More...
 
void createPosttoPreArray (unsigned int preN, unsigned int postN, SparseProjection *C)
 Utility to generate the YALE array structure with post-to-pre arrangement from the original pre-to-post arrangement where postsynaptic feedback is necessary (learning etc) More...
 
template<typename PostIndexType >
void createPosttoPreArray (unsigned int preN, unsigned int postN, RaggedProjection< PostIndexType > *C)
 Utility to generate the RAGGED array structure with post-to-pre arrangement from the original pre-to-post arrangement where postsynaptic feedback is necessary (learning etc) More...
 
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, i.e. the inverse mapping of remap. This is needed if SynapseDynamics accesses pre-synaptic variables. More...
 
template<typename PostIndexType >
void createPreIndices (unsigned int preN, unsigned int, RaggedProjection< PostIndexType > *C)
 
void initializeSparseArray (const 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 values from the host) More...
 
template<typename PostIndexType >
void initializeRaggedArray (const RaggedProjection< PostIndexType > &C, PostIndexType *dInd, unsigned int *dRowLength, unsigned int preN)
 Function for initializing conductance array indices for sparse matrices on the GPU (by copying the values from the host) More...
 
void initializeSparseArrayRev (const 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 copying the values from the host) More...
 
void initializeSparseArrayPreInd (const SparseProjection &C, unsigned int *dPreInd)
 Function for initializing reversed conductance arrays presynaptic indices for sparse matrices on the GPU (by copying the values from the host) More...
 
template<typename PostIndexType >
void initializeRaggedArrayRev (const RaggedProjection< PostIndexType > &C, unsigned int *dColLength, unsigned int *dRemap, unsigned int postN)
 Function for initializing reversed conductance array indices for sparse matrices on the GPU (by copying the values from the host) More...
 
template<typename PostIndexType >
void initializeRaggedArraySynRemap (const RaggedProjection< PostIndexType > &C, unsigned int *dSynRemap)
 Function for initializing reversed conductance arrays presynaptic indices for sparse matrices on the GPU (by copying the values from the host) More...
 

Function Documentation

◆ countEntriesAbove()

template<class DATATYPE >
unsigned int countEntriesAbove ( DATATYPE *  Array,
int  sz,
double  includeAbove 
)

Utility to count how many entries above a specified value exist in a float array.

◆ createPosttoPreArray() [1/2]

void createPosttoPreArray ( unsigned int  preN,
unsigned int  postN,
SparseProjection C 
)

Utility to generate the YALE array structure with post-to-pre arrangement from the original pre-to-post arrangement where postsynaptic feedback is necessary (learning etc)

Utility to generate the YALE array structure with post-to-pre arrangement from the original pre-to-post arrangement where postsynaptic feedback is necessary (learning etc)

◆ createPosttoPreArray() [2/2]

template<typename PostIndexType >
void createPosttoPreArray ( unsigned int  preN,
unsigned int  postN,
RaggedProjection< PostIndexType > *  C 
)

Utility to generate the RAGGED array structure with post-to-pre arrangement from the original pre-to-post arrangement where postsynaptic feedback is necessary (learning etc)

◆ createPreIndices() [1/2]

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, i.e. the inverse mapping of remap. This is needed if SynapseDynamics accesses pre-synaptic variables.

◆ createPreIndices() [2/2]

template<typename PostIndexType >
void createPreIndices ( unsigned int  preN,
unsigned int  ,
RaggedProjection< PostIndexType > *  C 
)

◆ createSparseConnectivityFromDense()

template<class DATATYPE >
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.

◆ getG()

template<class DATATYPE >
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 SparseProjection struct doesnt hold the preN size (it should!) it is not possible to check the parameter validity. This fn may therefore crash unless user knows max poss X.

◆ getSparseVar()

template<class DATATYPE >
float getSparseVar ( DATATYPE *  wuvar,
SparseProjection sparseStruct,
unsigned int  x,
unsigned int  y 
)

◆ initializeRaggedArray()

template<typename PostIndexType >
void initializeRaggedArray ( const RaggedProjection< PostIndexType > &  C,
PostIndexType *  dInd,
unsigned int *  dRowLength,
unsigned int  preN 
)

Function for initializing conductance array indices for sparse matrices on the GPU (by copying the values from the host)

◆ initializeRaggedArrayRev()

template<typename PostIndexType >
void initializeRaggedArrayRev ( const RaggedProjection< PostIndexType > &  C,
unsigned int *  dColLength,
unsigned int *  dRemap,
unsigned int  postN 
)

Function for initializing reversed conductance array indices for sparse matrices on the GPU (by copying the values from the host)

◆ initializeRaggedArraySynRemap()

template<typename PostIndexType >
void initializeRaggedArraySynRemap ( const RaggedProjection< PostIndexType > &  C,
unsigned int *  dSynRemap 
)

Function for initializing reversed conductance arrays presynaptic indices for sparse matrices on the GPU (by copying the values from the host)

◆ initializeSparseArray()

void initializeSparseArray ( const 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 values from the host)

◆ initializeSparseArrayPreInd()

void initializeSparseArrayPreInd ( const SparseProjection C,
unsigned int *  dPreInd 
)

Function for initializing reversed conductance arrays presynaptic indices for sparse matrices on the GPU (by copying the values from the host)

◆ initializeSparseArrayRev()

void initializeSparseArrayRev ( const 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 copying the values from the host)

◆ setSparseConnectivityFromDense()

template<class DATATYPE >
void setSparseConnectivityFromDense ( DATATYPE *  wuvar,
int  preN,
int  postN,
DATATYPE *  tmp_gRNPN,
SparseProjection sparseStruct 
)

Function for setting the values of SPARSE connectivity matrix.