def trm_indices_diag(n):
    """generate (i,j) indeces of a triangular matrix of n rows (or columns),
    with diagonal

    Parameters
    ----------

    n : int
        Matrix size
"""
    for i in range(0, n):
        for j in range(i + 1):
            yield i, j
