brainpy.math.operators.pre2post_event_sum#

brainpy.math.operators.pre2post_event_sum(events, pre2post, post_num, values=1.0)[source]#

The pre-to-post event-driven synaptic summation with CSR synapse structure.

When values is a scalar, this function is equivalent to

post_val = np.zeros(post_num)
post_ids, idnptr = pre2post
for i in range(pre_num):
  if events[i]:
    for j in range(idnptr[i], idnptr[i+1]):
      post_val[post_ids[i]] += values

When values is a vector (with the length of len(post_ids)), this function is equivalent to

post_val = np.zeros(post_num)

post_ids, idnptr = pre2post
for i in range(pre_num):
  if events[i]:
    for j in range(idnptr[i], idnptr[i+1]):
      post_val[post_ids[i]] += values[j]
Parameters
  • events (Array) – The events, must be bool.

  • pre2post (tuple of Array, tuple of Array) – A tuple contains the connection information of pre-to-post.

  • post_num (int) – The number of post-synaptic group.

  • values (float, Array) – The value to make summation.

Returns

out – A tensor with the shape of post_num.

Return type

JaxArray, jax.numpy.ndarray