- cupyx.scipy.spatial.distance.cdist(XA, XB, metric='euclidean', out=None, **kwargs)#
Compute distance between each pair of the two collections of inputs.
XA (array_like) – An \(m_A\) by \(n\) array of \(m_A\) original observations in an \(n\)-dimensional space. Inputs are converted to float type.
XB (array_like) – An \(m_B\) by \(n\) array of \(m_B\) original observations in an \(n\)-dimensional space. Inputs are converted to float type.
metric (str, optional) – The distance metric to use. The distance function can be ‘canberra’, ‘chebyshev’, ‘cityblock’, ‘correlation’, ‘cosine’, ‘euclidean’, ‘hamming’, ‘hellinger’, ‘jensenshannon’, ‘kl_divergence’, ‘matching’, ‘minkowski’, ‘russellrao’, ‘sqeuclidean’.
out (cupy.ndarray, optional) – The output array. If not None, the distance matrix Y is stored in this array.
**kwargs (dict, optional) – Extra arguments to metric: refer to each metric documentation for a list of all possible arguments. Some possible arguments: p (float): The p-norm to apply for Minkowski, weighted and unweighted. Default: 2.0
- A \(m_A\) by \(m_B\) distance matrix is
returned. For each \(i\) and \(j\), the metric
dist(u=XA[i], v=XB[j])is computed and stored in the \(ij\) th entry.
- Return type