sparse_random_matrix
sparse_random_matrix(pre, post, proba, weights)
Returns a sparse lil-matrix for use in Projection.from_sparse()
.
Creates a scipy.sparse.lil_matrix
connectivity matrix that connects the pre
and post
populations with the probability p
and the value weight
, which can be either a constant or an ANNarchy random distribution object.
= net.create(100, neuron)
pop1 = net.create(100, neuron)
pop2 = net.connect(pre=pop1, post=pop2, target='exc')
proj
= sparse_random_matrix(pre=pop1, post=pop2, p=0.1, w=ann.Uniform(0.0, 1.0))
matrix proj.from_sparse(matrix)
Parameters
Name | Type | Description | Default |
---|---|---|---|
pre | Population | pre-synaptic population. | required |
post | Population | post-synaptic population. | required |
proba | float | connection probability. | required |
weights | float | RandomDistribution | weight values (constant or random). | required |