scipy.spatial.cKDTree.sparse_distance_matrix¶
-
cKDTree.
sparse_distance_matrix
(self, other, max_distance, p=2.0)¶ Compute a sparse distance matrix
Computes a distance matrix between two cKDTrees, leaving as zero any distance greater than max_distance.
- Parameters
- othercKDTree
- max_distancepositive float
- pfloat, 1<=p<=infinity
Which Minkowski p-norm to use. A finite large p may cause a ValueError if overflow can occur.
- output_typestring, optional
Which container to use for output data. Options: ‘dok_matrix’, ‘coo_matrix’, ‘dict’, or ‘ndarray’. Default: ‘dok_matrix’.
- Returns
- resultdok_matrix, coo_matrix, dict or ndarray
Sparse matrix representing the results in “dictionary of keys” format. If a dict is returned the keys are (i,j) tuples of indices. If output_type is ‘ndarray’ a record array with fields ‘i’, ‘j’, and ‘v’ is returned,