code: def _map_tril_1d_on_2d(indices, dims):
      
  
      N = (dims * dims - dims) / 2
  
      m = np.ceil(np.sqrt(2 * N))
      c = m - np.round(np.sqrt(2 * (N - indices))) - 1
      r = np.mod(indices + (c + 1) * (c + 2) / 2 - 1, m) + 1
  
      return np.array([r, c], dtype=np.int64)
docs: Map 1d indices on lower triangular matrix in 2d.