19#ifndef _FORMATION_DISTANCE_DEPENDENT_H_
20#define _FORMATION_DISTANCE_DEPENDENT_H_
25#define MAX_SHORT 65535
60 return a < 0 ? -a : a;
78 uint32_t pre_x, pre_y, post_x, post_y;
80 uint32_t pre_global_id = current_state->key_atom_info->lo_atom +
81 current_state->pre_syn_id;
82 uint32_t post_global_id = current_state->post_syn_id +
86 pre_x = muliulr(pre_global_id,
params->grid_x_recip);
87 post_x = muliulr(post_global_id,
params->grid_x_recip);
94 uint32_t pre_y_div = muliulr(pre_global_id,
params->grid_y_recip);
95 uint32_t post_y_div = muliulr(post_global_id,
params->grid_y_recip);
96 pre_y = pre_global_id - (pre_y_div *
params->grid_y);
97 post_y = post_global_id - (post_y_div *
params->grid_y);
104 uint32_t delta_x, delta_y;
105 delta_x =
my_abs(pre_x - post_x);
106 delta_y =
my_abs(pre_y - post_y);
108 if (delta_x >
params->grid_x >> 1 &&
params->grid_x > 1) {
109 delta_x -=
params->grid_x;
112 if (delta_y >
params->grid_y >> 1 &&
params->grid_y > 1) {
113 delta_y -=
params->grid_y;
116 uint32_t distance = delta_x * delta_x + delta_y * delta_y;
119 uint16_t probability;
120 int16_t controls = current_state->pre_population_info->sp_control;
122 if (distance >=
params->ff_prob_size) {
125 probability =
params->prob_tables[distance];
127 if (distance >=
params->lat_prob_size) {
130 probability =
params->prob_tables[
params->ff_prob_size + distance];
133 if (r > probability) {
struct synaptic_row * synaptic_row_t
The type of a synaptic row.
static bool sp_structs_add_synapse(current_state_t *restrict current_state, synaptic_row_t restrict row)
Adds a synapse to the relevant structures.
uint32_t post_low_atom
Low atom copied from rewiring data.
#define IS_CONNECTION_LAT
Flag: Is connection lateral?
mars_kiss64_seed_t * local_seed
Seed referenced from rewiring data.
static uint32_t rand_int(uint32_t max, mars_kiss64_seed_t seed)
struct representing the current state of rewiring
static stdp_params params
Configuration parameters.