code: def sum_distances(self, indices, distance_matrix):
          
          combs_tup = np.array(tuple(combinations(indices, 2)))
  
          # Put indices from tuples into two-dimensional array.
          combs = np.array([[i[0] for i in combs_tup],
                            [i[1] for i in combs_tup]])
  
          # Calculate distance (vectorized)
          dist = np.sqrt(
              np.sum(np.square(distance_matrix[combs[0], combs[1]]), axis=0))
  
          return dist
docs: Calculate combinatorial distance between a select group of
          trajectories, indicated by indices
  
          Arguments
          ---------
          indices : tuple
          distance_matrix : numpy.ndarray (M,M)
  
          Returns
          -------
          numpy.ndarray
  
          Notes
          -----
          This function can perhaps be quickened by calculating the sum of the
          distances. The calculated distances, as they are right now,
          are only used in a relative way. Purely summing distances would lead
          to the same result, at a perhaps quicker rate.