'check whether pairwise distances of indices satisfy condition'

def check_set(self, indices):

    indtup = tuple(indices)
    if (indtup in self.cache_result):
        return self.cache_result[indtup]
    else:
        set_distance_matrix = self.distance_matrix[(np.asarray(indices)[:, None], indices)]
        n_elements = len(indices)
        if np.any((set_distance_matrix > self.crit[(n_elements - 1)])):
            res = True
        else:
            res = False
        self.cache_result[indtup] = res
        return res
