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

The implementation of a parameter generator. More...

#include "param_generator.h"
#include <spin1_api.h>
#include <debug.h>
#include "generator_types.h"
#include "param_generators/param_generator_constant.h"
#include "param_generators/param_generator_uniform.h"
#include "param_generators/param_generator_normal.h"
#include "param_generators/param_generator_normal_clipped.h"
#include "param_generators/param_generator_normal_clipped_to_boundary.h"
#include "param_generators/param_generator_exponential.h"
#include "param_generators/param_generator_exponential_clipped.h"

Go to the source code of this file.

Data Structures

struct  param_generator_info
 A "class" for parameter generators. More...
 
struct  param_generator_t
 The data for a parameter generator. More...
 

Enumerations

enum  {
  CONSTANT , UNIFORM , NORMAL , NORMAL_CLIPPED ,
  NORMAL_CLIPPED_BOUNDARY , EXPONENTIAL , EXPONENTIAL_CLIPPED , N_PARAM_GENERATORS
}
 The "hashes" for parameter generators. More...
 

Functions

param_generator_t param_generator_init (uint32_t hash, void **in_region)
 Initialise a specific parameter generator.
 
accum param_generator_generate (param_generator_t generator)
 Generate value with a parameter generator.
 
void param_generator_free (param_generator_t generator)
 Finish with a parameter generator.
 

Variables

static const struct param_generator_info param_generators []
 An Array of known generators.
 

Detailed Description

The implementation of a parameter generator.

Definition in file param_generator.c.


Data Structure Documentation

◆ param_generator_info

struct param_generator_info

A "class" for parameter generators.

!

Definition at line 57 of file param_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_param_func * initialize Initialise the generator.
generate_param_func * generate Generate values with a parameter generator.
free_func * free Free any data for the generator.

◆ param_generator

struct param_generator

The data for a parameter generator.

Parameter generator "object".

Definition at line 75 of file param_generator.c.

Data Fields
const param_generator_info * type
void * data

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

The "hashes" for parameter generators.

Enumerator
CONSTANT 

A parameter that is a constant.

UNIFORM 

A parameter that is a uniformly-distributed random variable.

NORMAL 

A parameter that is a normally-distributed random variable.

NORMAL_CLIPPED 

A parameter that is a clipped-normally-distributed random variable.

NORMAL_CLIPPED_BOUNDARY 

A parameter that is a clamped-normally-distributed random variable.

EXPONENTIAL 

A parameter that is an exponentially-distributed random variable.

EXPONENTIAL_CLIPPED 

A parameter that is a clipped-exponentially-distributed random variable.

N_PARAM_GENERATORS 

The number of known generators.

Definition at line 35 of file param_generator.c.

Function Documentation

◆ param_generator_init()

param_generator_t param_generator_init ( uint32_t  hash,
void **  region 
)

Initialise a specific parameter 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
Returns
An initialised parameter generator that can be used with other functions, or NULL if it couldn't be initialised for any reason

Definition at line 114 of file param_generator.c.

◆ param_generator_generate()

accum param_generator_generate ( param_generator_t  generator)

Generate value with a parameter generator.

Parameters
[in]generatorThe generator to use to generate values
Returns
The value generated

Definition at line 141 of file param_generator.c.

◆ param_generator_free()

void param_generator_free ( param_generator_t  generator)

Finish with a parameter generator.

Parameters
[in]generatorThe generator to free

Definition at line 145 of file param_generator.c.

Variable Documentation

◆ param_generators

const struct param_generator_info param_generators[]
static
Initial value:
= {
}
@ NORMAL
A parameter that is a normally-distributed random variable.
@ CONSTANT
A parameter that is a constant.
@ UNIFORM
A parameter that is a uniformly-distributed random variable.
@ EXPONENTIAL
A parameter that is an exponentially-distributed random variable.
@ NORMAL_CLIPPED
A parameter that is a clipped-normally-distributed random variable.
@ NORMAL_CLIPPED_BOUNDARY
A parameter that is a clamped-normally-distributed random variable.
@ EXPONENTIAL_CLIPPED
A parameter that is a clipped-exponentially-distributed random variable.
static void * param_generator_constant_initialize(void **region)
How to initialise the constant parameter generator.
static accum param_generator_constant_generate(void *generator)
How to generate values with the constant parameter generator.
static void param_generator_constant_free(void *generator)
How to free any data for the constant parameter generator.
static accum param_generator_exponential_generate(void *generator)
How to generate values with the exponential RNG parameter generator.
static void param_generator_exponential_free(void *generator)
How to free any data for the exponential RNG parameter generator.
static void * param_generator_exponential_initialize(void **region)
How to initialise the exponential RNG parameter generator.
static accum param_generator_exponential_clipped_generate(void *generator)
How to generate values with the exponential RNG parameter generator.
static void * param_generator_exponential_clipped_initialize(void **region)
How to initialise the exponential RNG parameter generator.
static void param_generator_exponential_clipped_free(void *generator)
How to free any data for the exponential RNG parameter generator.
static void * param_generator_normal_initialize(void **region)
How to initialise the normal RNG parameter generator.
static void param_generator_normal_free(void *generator)
How to free any data for the normal RNG parameter generator.
static accum param_generator_normal_generate(void *generator)
How to generate values with the normal RNG parameter generator.
static accum param_generator_normal_clipped_generate(void *generator)
How to generate values with the clipped normal RNG parameter generator.
static void param_generator_normal_clipped_free(void *generator)
How to free any data for the clipped normal RNG parameter generator.
static void * param_generator_normal_clipped_initialize(void **region)
How to initialise the clipped normal RNG parameter generator.
static void * param_generator_normal_clipped_boundary_initialize(void **region)
How to initialise the clamped normal RNG parameter generator.
static void param_generator_normal_clipped_boundary_free(void *generator)
How to free any data for the clamped normal RNG parameter generator.
static accum param_generator_normal_clipped_boundary_generate(void *generator)
How to generate values with the clamped normal RNG parameter generator.
static accum param_generator_uniform_generate(void *generator)
How to generate values with the uniform RNG parameter generator.
static void param_generator_uniform_free(void *generator)
How to free any data for the uniform RNG parameter generator.
static void * param_generator_uniform_initialize(void **region)
How to initialise the uniform RNG parameter generator.

An Array of known generators.

Definition at line 83 of file param_generator.c.