Skip to content

Commit

Permalink
Merge pull request #8186 from andfoy/fix_pdist_docstring
Browse files Browse the repository at this point in the history
Fix pdist docstring in order to specify that the returned matrix is condensed
  • Loading branch information
kmaehashi committed Feb 15, 2024
2 parents 34f8edb + 3428973 commit 7a19633
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions cupyx/scipy/spatial/distance.py
Original file line number Diff line number Diff line change
Expand Up @@ -543,10 +543,11 @@ def pdist(X, metric='euclidean', *, out=None, **kwargs):
Returns:
Y (cupy.ndarray):
A :math:`m` by :math:`m` distance matrix is
returned. For each :math:`i` and :math:`j`, the metric
``dist(u=X[i], v=X[j])`` is computed and stored in the
:math:`ij` th entry.
Returns a condensed distance matrix Y. For each :math:`i` and
:math:`j` and (where :math:`i < j < m`), where m is the number of
original observations. The metric ``dist(u=X[i], v=X[j])`` is
computed and stored in entry
``m * i + j - ((i + 2) * (i + 1)) // 2``.
"""
all_dist = cdist(X, X, metric=metric, out=out, **kwargs)
up_idx = cupy.triu_indices_from(all_dist, 1)
Expand Down

0 comments on commit 7a19633

Please sign in to comment.