firecrown.utils.upper_triangle_indices

firecrown.utils.upper_triangle_indices(n)[source]

generator that yields a sequence of tuples that carry the indices for an (n x n) upper-triangular matrix. This is a replacement for the nested loops:

for i in range(n):
for j in range(i, n):

Parameters

n (int) –