e3x.ops.indexed.sparse_pairwise_indices

e3x.ops.indexed.sparse_pairwise_indices(num, mask_self=True)[source]

Generates a sparse index list for all pairs of num elements.

Parameters:
  • num (int) – Number of elements.

  • mask_self (bool, default: True) – Whether self-connections (loops) should be masked out.

Return type:

Union[Tuple[Integer[Array, '... num*(num-1)'], Integer[Array, '... num*(num-1)']], Tuple[Integer[Array, '... num**2'], Integer[Array, '... num**2']]]

Returns:

A sparse index list specifying all pairs returned as a tuple (dst_idx, src_idx) with destination and source indices, respectively.