The network can handle various neuron's models and learning rules.
#define ASPI_NETWORK | ( | x | ) | (aspi_object_check (x, aspi_network ()), ((aspi_network_t *) x)) |
Referenced by aspi_basic_synapses_apply_callback_post(), aspi_basic_synapses_apply_callback_pre(), aspi_leaky_fire(), aspi_leaky_get_threshold_ip(), aspi_leaky_get_v_trace(), aspi_leaky_get_v_trace_at(), aspi_leaky_has_fired(), aspi_leaky_update_voltage(), aspi_network_act(), aspi_network_calc_max_delays(), aspi_network_dtor(), aspi_network_dup(), aspi_network_get_avg_v(), aspi_network_get_delay(), aspi_network_get_neuron(), aspi_network_get_neuron_index(), aspi_network_get_size(), aspi_network_get_time(), aspi_network_get_weight(), aspi_network_init_full(), aspi_network_learn_ranged(), aspi_network_set_delay(), aspi_network_set_rule(), aspi_network_set_weight(), aspi_sparse_synapses_apply_callback_post(), and aspi_sparse_synapses_apply_callback_pre().
#define ASPI_NETWORK_CLASS | ( | x | ) | (aspi_class_check (x, aspi_network ()), ((aspi_network_class_t * ) x)) |
aspi_class_t * aspi_network | ( | void | ) |
Get network class
References aspi_class_register(), aspi_network_dtor(), aspi_network_dup(), aspi_object(), and _aspi_class::id.
Referenced by aspi_network_init_full(), and aspi_network_ml().
void aspi_network_act | ( | aspi_object_t * | self | ) |
Monothread implementation of act method.
This method run one time step. This one doesn't support multithread..
References ASPI_NETWORK, aspi_neuron_class_act(), and aspi_network_t::model.
void aspi_network_calc_max_delays | ( | aspi_object_t * | self | ) |
Alloc necessary memory for delays
This method should be called after last call to set_delay, since it used it.
You better use a method that wraps set_delay and this one.
References ASPI_NETWORK, aspi_neuron_class_reinit(), and aspi_network_t::model.
Referenced by aspi_network_ml_init_poisson(), and aspi_network_ml_init_sparse().
void aspi_network_dtor | ( | aspi_object_t * | self | ) |
Network destructor
References ASPI_NETWORK, aspi_object_dtor(), aspi_object_release(), aspi_network_t::neurons, aspi_network_t::number_neurons, and aspi_network_t::synapses.
Referenced by aspi_network(), and aspi_network_ml_dtor().
aspi_object_t * aspi_network_dup | ( | aspi_object_t * | self | ) |
Copy the network
This method send a new copy of the network that shares nearly everything with the precedent ; except the individual neurons.
Note that the weights, delays, etc. are shared. So it might not be a good idea to apply STDP to different networks
This method actually mainly do a copy of the data, except that we do some alloc' and retain.
Theoretically, cloning a network_ml should send a network_ml back.
References ASPI_NETWORK, aspi_network_get_size(), aspi_neuron_class_reinit(), ASPI_OBJECT, aspi_object_copy(), aspi_object_dup(), aspi_object_retain(), aspi_return_value_if_fail, aspi_network_t::model, aspi_network_t::neurons, and aspi_network_t::synapses.
Referenced by aspi_network(), and aspi_network_ml_dup().
double aspi_network_get_avg_v | ( | aspi_object_t * | self | ) |
Return the average voltage of the network
References ASPI_NETWORK, aspi_network_get_size(), aspi_neuron_get_v(), and aspi_network_t::neurons.
double aspi_network_get_cluster | ( | aspi_object_t * | self | ) |
Get weighted clustering coefficient Use the weighted clustering way of computing it of onnela05
References aspi_network_get_node_degrees(), aspi_network_get_node_strengths(), aspi_network_get_size(), and aspi_network_get_weight().
unsigned int aspi_network_get_delay | ( | aspi_object_t * | self, | |
int | pre, | |||
int | post | |||
) |
Get a synapse 's delay
return 1 if delays has not been alloc'ed
Get a synapse's delay
References ASPI_NETWORK, aspi_synapses_get_delay(), and aspi_network_t::synapses.
struct aspi_efficiency aspi_network_get_efficiency | ( | aspi_object_t * | self | ) | [read] |
Get «efficiency» measures (used to see if a network is small-world or not, see [Latora, Marchiori 2001]
self,: | the network | |
eloc,: | pointer to an alloced double | |
eglob,: | pointer to an alloced double |
References aspi_network_get_size(), aspi_network_get_weight(), aspi_efficiency::eglob, and aspi_efficiency::eloc.
double aspi_network_get_freq_kurtosis | ( | aspi_object_t * | self | ) |
Return frequency kurtosis Only works for Leaky neurons
It seems that code could be factorised from get_skewness, but it must also be independent function, so i shall investigate later.
References aspi_leaky(), aspi_leaky_get_freq(), aspi_network_get_neuron(), aspi_network_get_size(), aspi_object_is_a(), and aspi_return_value_if_fail.
double aspi_network_get_freq_skewness | ( | aspi_object_t * | self | ) |
Return frequency skewness Only works for Leaky neurons
References aspi_leaky(), aspi_leaky_get_freq(), aspi_network_get_neuron(), aspi_network_get_size(), aspi_object_is_a(), and aspi_return_value_if_fail.
aspi_object_t * aspi_network_get_neuron | ( | aspi_object_t * | self, | |
unsigned int | n | |||
) |
Return the nthn neuron.
References ASPI_NETWORK, aspi_network_get_size(), aspi_return_value_if_fail, and aspi_network_t::neurons.
Referenced by aspi_network_get_freq_kurtosis(), aspi_network_get_freq_skewness(), aspi_network_get_neurons(), and aspi_network_ml_get_neuron().
int aspi_network_get_neuron_index | ( | aspi_object_t * | self, | |
aspi_object_t * | neuron | |||
) |
Return the index of a neuron, or -1 if not in the network
References ASPI_NETWORK, aspi_network_get_size(), and aspi_network_t::neurons.
aspi_object_t ** aspi_network_get_neurons | ( | aspi_object_t * | self | ) |
Return all neurons in the interval.
Return a array of all neurons. The array is dynamically alloced and must thus be freed ; however, neurons must not: the network take care of them.
References aspi_network_get_neuron(), and aspi_network_get_size().
int * aspi_network_get_node_degrees | ( | aspi_object_t * | self | ) |
Get node degrees, ie the number of non-null outgoing weights
References aspi_network_get_size(), and aspi_network_get_weight().
Referenced by aspi_network_get_cluster().
double * aspi_network_get_node_strengths | ( | aspi_object_t * | self | ) |
Get node strengths, similar to degrees, but weighted
We use abs(wij) so all strengths are not around zero
References aspi_network_get_size(), and aspi_network_get_weight().
Referenced by aspi_network_get_cluster().
int aspi_network_get_size | ( | aspi_object_t * | self | ) |
Get the number of neurons
References ASPI_NETWORK, and aspi_network_t::number_neurons.
Referenced by aspi_network_dup(), aspi_network_get_avg_v(), aspi_network_get_cluster(), aspi_network_get_efficiency(), aspi_network_get_freq_kurtosis(), aspi_network_get_freq_skewness(), aspi_network_get_neuron(), aspi_network_get_neuron_index(), aspi_network_get_neurons(), aspi_network_get_node_degrees(), aspi_network_get_node_strengths(), and aspi_network_learn().
int aspi_network_get_time | ( | aspi_object_t * | self | ) |
Get the time
References ASPI_NETWORK, and aspi_network_t::time.
double aspi_network_get_weight | ( | aspi_object_t * | self, | |
int | pre, | |||
int | post | |||
) |
Get a synapse's weight
Get a synapse's weight
References ASPI_NETWORK, aspi_synapses_get_weight(), and aspi_network_t::synapses.
Referenced by aspi_network_get_cluster(), aspi_network_get_efficiency(), aspi_network_get_node_degrees(), and aspi_network_get_node_strengths().
aspi_object_t * aspi_network_init | ( | aspi_object_t * | self, | |
aspi_class_t * | neuron_model, | |||
int | neurons | |||
) |
Simple network initializer
Init a network with basic synapses.
References aspi_basic_synapses(), and aspi_network_init_full().
aspi_object_t * aspi_network_init_full | ( | aspi_object_t * | self, | |
aspi_class_t * | model, | |||
aspi_class_t * | synapse_model, | |||
int | neurons | |||
) |
Network initializer
self | : an alloced network, or NULL | |
model | : neuron model | |
synapse_model,: | synaptic model (basic_synapses or sparse_synapses) | |
neurons | : number of neurons of the network |
References aspi_class_instantiate(), ASPI_NETWORK, aspi_network(), aspi_neuron_class_reinit(), aspi_object_init(), aspi_synapses_init_generic(), DEFAULT_LEARN_FUNC, aspi_network_t::learn_func, aspi_network_t::model, aspi_network_t::neurons, aspi_network_t::number_neurons, aspi_network_t::synapses, and aspi_network_t::time.
Referenced by aspi_network_init(), and aspi_network_ml_init_sparse().
void aspi_network_learn | ( | aspi_object_t * | self, | |
double | alpha_plus, | |||
double | alpha_neg | |||
) |
Learn
Apply the learning rule to all neurons
References aspi_network_get_size(), and aspi_network_learn_ranged().
void aspi_network_learn_ranged | ( | aspi_object_t * | self, | |
double | alpha_plus, | |||
double | alpha_neg, | |||
int | from_begin, | |||
int | from_end, | |||
int | to_begin, | |||
int | to_end | |||
) |
Learn
Apply the learning rule to the neurons from to last
References ASPI_NETWORK, aspi_return_if_fail, and aspi_network_t::learn_func.
Referenced by aspi_network_learn().
void aspi_network_set_delay | ( | aspi_object_t * | self, | |
int | pre, | |||
int | post, | |||
unsigned int | delay | |||
) |
Set a synapse's delay
If delays have not been initialized, we alloc it. It is not alloc'ed by default since a 0 delay net doesn't need it
References ASPI_NETWORK, aspi_synapses_set_delay(), and aspi_network_t::synapses.
Referenced by aspi_network_ml_init_poisson(), and aspi_network_ml_init_sparse().
void aspi_network_set_rule | ( | aspi_object_t * | self, | |
aspi_learning_rule_t | learn_func | |||
) |
Change the netork's learning rule
References ASPI_NETWORK, and aspi_network_t::learn_func.
void aspi_network_set_weight | ( | aspi_object_t * | self, | |
int | pre, | |||
int | post, | |||
double | weight | |||
) |
Set a synapse's weight
Set a synapse's weight
References ASPI_NETWORK, aspi_synapses_set_weight(), and aspi_network_t::synapses.
Referenced by aspi_network_ml_init_sparse().