sPyNNaker neural_modelling 7.3.1
Loading...
Searching...
No Matches
Data Structures | Enumerations | Functions | Variables
matrix_generator.c File Reference

The implementation of the matrix generator. More...

#include "matrix_generator.h"
#include <spin1_api.h>
#include <debug.h>
#include "generator_types.h"
#include "matrix_generators/matrix_generator_static.h"
#include "matrix_generators/matrix_generator_stdp.h"
#include "matrix_generators/matrix_generator_neuromodulation.h"
#include "matrix_generators/matrix_generator_weight_changer.h"
#include <delay_extension/delay_extension.h>

Go to the source code of this file.

Data Structures

struct  matrix_generator_info
 A "class" for matrix generators. More...
 
struct  matrix_generator_t
 The data for a matrix generator. More...
 

Enumerations

enum  {
  STATIC_MATRIX_GENERATOR , PLASTIC_MATRIX_GENERATOR , NEUROMODULATION_MATRIX_GENERATOR , WEIGHT_CHANGER_MATRIX_GENERATOR ,
  N_MATRIX_GENERATORS
}
 The "hashes" for synaptic matrix generators. More...
 

Functions

matrix_generator_t matrix_generator_init (uint32_t hash, void **in_region, void *synaptic_matrix)
 Initialise a specific matrix generator.
 
void matrix_generator_free (matrix_generator_t generator)
 Finish with a matrix generator.
 
bool matrix_generator_write_synapse (matrix_generator_t generator, uint32_t pre_index, uint16_t post_index, accum weight, uint16_t delay, unsigned long accum weight_scale)
 Write a synapse with a matrix generator.
 

Variables

static const struct matrix_generator_info matrix_generators []
 An Array of known generators.
 

Detailed Description

The implementation of the matrix generator.

Definition in file matrix_generator.c.


Data Structure Documentation

◆ matrix_generator_info

struct matrix_generator_info

A "class" for matrix generators.

Definition at line 51 of file matrix_generator.c.

Data Fields
generator_hash_t hash The hash of the generator.

For now, hash is just an index agreed between Python and here.

initialize_matrix_func * initialize Initialise the generator.
write_synapse_func * write_synapse Generate a row of a matrix with a matrix generator.
free_func * free Free any data for the generator.

◆ matrix_generator

struct matrix_generator

The data for a matrix generator.

Data type for matrix generator.

Definition at line 72 of file matrix_generator.c.

Data Fields
const matrix_generator_info * type
void * data

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

The "hashes" for synaptic matrix generators.

Enumerator
STATIC_MATRIX_GENERATOR 

Generate a pure static synaptic matrix.

PLASTIC_MATRIX_GENERATOR 

Generate a synaptic matrix with STDP.

NEUROMODULATION_MATRIX_GENERATOR 

Generate a synaptic matrix for Neuromodulation.

WEIGHT_CHANGER_MATRIX_GENERATOR 

Generate a synaptic matrix for weight change.

N_MATRIX_GENERATORS 

The number of known generators.

Definition at line 33 of file matrix_generator.c.

Function Documentation

◆ matrix_generator_init()

matrix_generator_t matrix_generator_init ( uint32_t  hash,
void **  region,
void *  synaptic_matrix 
)

Initialise a specific matrix generator.

Parameters
[in]hashThe identifier of the generator to initialise
[in,out]regionThe address to read data from; updated to position after data has been read
[in]synaptic_matrixThe address of the base of the synaptic matrix
Returns
An initialised matrix generator that can be used with other functions, or NULL if it couldn't be initialised for any reason

Definition at line 99 of file matrix_generator.c.

◆ matrix_generator_free()

void matrix_generator_free ( matrix_generator_t  generator)

Finish with a matrix generator.

Parameters
[in]generatorThe generator to free

Definition at line 127 of file matrix_generator.c.

◆ matrix_generator_write_synapse()

bool matrix_generator_write_synapse ( matrix_generator_t  generator,
uint32_t  pre_index,
uint16_t  post_index,
accum  weight,
uint16_t  delay,
unsigned long accum  weight_scale 
)

Write a synapse with a matrix generator.

Parameters
[in]generatorThe generator to use to generate the matrix
[in]pre_indexThe index of the pre-neuron relative to the start of the matrix
[in]post_indexThe index of the post-neuron on this core
[in]weightThe weight of the synapse in raw form
[in]delayThe delay of the synapse in time steps
[in]weight_scaleThe scale to apply to the weight if needed

Definition at line 133 of file matrix_generator.c.

Variable Documentation

◆ matrix_generators

const struct matrix_generator_info matrix_generators[]
static
Initial value:
= {
matrix_generator_neuromodulation_write_synapse,
matrix_generator_changer_write_synapse,
}
@ PLASTIC_MATRIX_GENERATOR
Generate a synaptic matrix with STDP.
@ WEIGHT_CHANGER_MATRIX_GENERATOR
Generate a synaptic matrix for weight change.
@ NEUROMODULATION_MATRIX_GENERATOR
Generate a synaptic matrix for Neuromodulation.
@ STATIC_MATRIX_GENERATOR
Generate a pure static synaptic matrix.
void * matrix_generator_neuromodulation_initialize(void **region, void *synaptic_matrix)
Initialise the Neuromodulation synaptic matrix generator.
void matrix_generator_neuromodulation_free(void *generator)
Free any data for the STDP synaptic matrix generator.
static bool matrix_generator_static_write_synapse(void *generator, uint32_t pre_index, uint16_t post_index, accum weight, uint16_t delay, unsigned long accum weight_scale)
How to write a synapse to a matrix.
static void matrix_generator_static_free(void *generator)
How to free any data for the static synaptic matrix generator.
static void * matrix_generator_static_initialize(void **region, void *synaptic_matrix)
How to initialise the static synaptic matrix generator.
void * matrix_generator_stdp_initialize(void **region, void *synaptic_matrix)
Initialise the STDP synaptic matrix generator.
void matrix_generator_stdp_free(void *generator)
Free any data for the STDP synaptic matrix generator.
static bool matrix_generator_stdp_write_synapse(void *generator, uint32_t pre_index, uint16_t post_index, accum weight, uint16_t delay, unsigned long accum weight_scale)
How to write a synapse to a matrix.
void matrix_generator_changer_free(void *generator)
Free any data for the matrix generator.
void * matrix_generator_changer_initialize(void **region, void *synaptic_matrix)
Initialise the Changer synaptic matrix generator.

An Array of known generators.

Definition at line 80 of file matrix_generator.c.