cupyx.scipy.spatial.distance.hamming#

cupyx.scipy.spatial.distance.hamming(u, v)[source]#

Compute the Hamming distance between two 1-D arrays.

The Hamming distance is defined as the proportion of elements in both u and v that are not in the exact same position:

\[d(u, v) = \frac{1}{n} \sum_{k=0}^n u_i \neq v_i\]

where \(x \neq y\) is one if \(x\) is different from \(y\) and zero otherwise.

Parameters:
  • u (array_like) – Input array of size (N,)

  • v (array_like) – Input array of size (N,)

Returns:

The Hamming distance between vectors u and v.

Return type:

hamming (double)