code: def compute_distance_matrix(self, input_sample, num_samples, num_params,
                                  num_groups=None,
                                  local_optimization=False):
          
          if num_groups:
              self.check_input_sample(input_sample, num_groups, num_samples)
          else:
              self.check_input_sample(input_sample, num_params, num_samples)
  
          index_list = self._make_index_list(num_samples, num_params, num_groups)
          distance_matrix = np.zeros(
              (num_samples, num_samples), dtype=np.float32)
  
          for j in range(num_samples):
              input_1 = input_sample[index_list[j]]
              for k in range(j + 1, num_samples):
                  input_2 = input_sample[index_list[k]]
  
                  # Fills the lower triangle of the matrix
                  if local_optimization is True:
                      distance_matrix[j, k] = self.compute_distance(
                          input_1, input_2)
  
                  distance_matrix[k, j] = self.compute_distance(input_1, input_2)
          return distance_matrix
docs: Computes the distance between each and every trajectory
  
          Each entry in the matrix represents the sum of the geometric distances
          between all the pairs of points of the two trajectories
  
          If the `groups` argument is filled, then the distances are still
          calculated for each trajectory,
  
          Arguments
          ---------
          input_sample : numpy.ndarray
              The input sample of trajectories for which to compute
              the distance matrix
          num_samples : int
              The number of trajectories
          num_params : int
              The number of factors
          num_groups : int, default=None
              The number of groups
          local_optimization : bool, default=False
              If True, fills the lower triangle of the distance matrix
  
          Returns
          -------
          distance_matrix : numpy.ndarray