class_docstr: Implements the local optimisation algorithm using the Strategy interface
class_docstr_tok: ["Implements","the","local","optimisation","algorithm","using","the","Strategy","interface"]
docstr: Calculate combinatorial distance between a select group of
  trajectories, indicated by indices
  
  Parameters
  ----------
  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.
docstr_tok: ["Calculate","combinatorial","distance","between","a","select","group","of","trajectories",",","indicated","by","indices","Parameters","--","--","--","--","--","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","."]
code: def sum_distances(
      self, indices: Tuple, distance_matrix: np.ndarray
  ) -> np.ndarray:
      """Calculate combinatorial distance between a select group of
      trajectories, indicated by indices
  
      Parameters
      ----------
      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.
      """
      combs_tup = combinations(indices, 2)
  
      combs = np.array(tuple(zip(*combs_tup)))
  
      # Calculate distance (vectorized)
      dist = np.sqrt(
          np.sum(np.square(distance_matrix[combs[0], combs[1]]), axis=0)
      )
  
      return dist
  
file_path: SALib/src/SALib/sample/morris/local.py
imports: from itertools import combinations
  import numpy
  from typing import List, Tuple, Union
  from .strategy import Strategy
label_desc: Use image node_id 3 for calling the LocalOptimisation obj's underlying member method code with example usage: obj.sum_distances(indices, distance_matrix) and returns: dist