sPyNNaker neural_modelling 7.2.2
Loading...
Searching...
No Matches
input_type_delta.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2017 The University of Manchester
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * https://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
19#ifndef _INPUT_TYPE_DELTA_H_
20#define _INPUT_TYPE_DELTA_H_
21
22#include "input_type.h"
23
25 // Time step in milliseconds
26 REAL time_step;
27};
28
29struct input_type_t {
30 // scale factor (1.0 / timestep)
31 REAL scale_factor;
32};
33
34static inline void input_type_initialise(input_type_t *state, input_type_params_t *params,
35 uint32_t n_steps_per_time_step) {
36 state->scale_factor = kdivk(1.0, kdivui(params->time_step, n_steps_per_time_step));
37}
38
39static inline void input_type_save_state(UNUSED input_type_t *state,
41}
42
52 input_t *restrict value, UNUSED input_type_t *input_type,
53 UNUSED uint16_t num_receptors) {
54 return value;
55}
56
64 input_t *restrict exc_input, const input_type_t *input_type,
65 UNUSED state_t membrane_voltage) {
66 for (int i=0; i < NUM_EXCITATORY_RECEPTORS; i++) {
67 exc_input[i] = exc_input[i] * input_type->scale_factor;
68 }
69}
70
78 input_t *restrict inh_input, const input_type_t *input_type,
79 UNUSED state_t membrane_voltage) {
80 for (int i=0; i < NUM_INHIBITORY_RECEPTORS; i++) {
81 inh_input[i] = inh_input[i] * input_type->scale_factor;
82 }
83}
84
85#endif // _INPUT_TYPE_DELTA_H_
API for synaptic inputs (see also src/neuron/synapse_types)
#define NUM_INHIBITORY_RECEPTORS
The number of inhibitory receptors.
Definition input_type.h:37
#define NUM_EXCITATORY_RECEPTORS
The number of excitatory receptors.
Definition input_type.h:28
static void input_type_convert_inhibitory_input_to_current(input_t *restrict inh_input, const input_type_t *input_type, state_t membrane_voltage)
Converts an inhibitory input into an inhibitory current.
static input_t * input_type_get_input_value(input_t *restrict value, input_type_t *input_type, uint16_t num_receptors)
Gets the actual input value. This allows any scaling to take place.
static void input_type_convert_excitatory_input_to_current(input_t *restrict exc_input, const input_type_t *input_type, state_t membrane_voltage)
Converts an excitatory input into an excitatory current.
Conductance input parameters.
Conductance state.
accum REAL
Type used for "real" numbers.
Definition maths-util.h:91
static REAL kdivk(REAL a, REAL b)
Divides an accum by another accum.
Definition maths-util.h:234
static REAL kdivui(REAL a, uint32_t b)
Divides an accum by an unsigned integer.
Definition maths-util.h:258
REAL state_t
The type of a state variable.
REAL input_t
The type of an input.
static stdp_params params
Configuration parameters.