SciPy

scipy.spatial.KDTree.sparse_distance_matrix

KDTree.sparse_distance_matrix(self, other, max_distance, p=2.0)[source]

Compute a sparse distance matrix

Computes a distance matrix between two KDTrees, leaving as zero any distance greater than max_distance.

Parameters
otherKDTree
max_distancepositive float
pfloat, optional
Returns
resultdok_matrix

Sparse matrix representing the results in “dictionary of keys” format.

Previous topic

scipy.spatial.KDTree.query_pairs

Next topic

scipy.spatial.cKDTree