SciPy

scipy.spatial.distance.chebyshev

scipy.spatial.distance.chebyshev(u, v, w=None)[source]

Compute the Chebyshev distance.

Computes the Chebyshev distance between two 1-D arrays u and v, which is defined as

\[\max_i {|u_i-v_i|}.\]
Parameters
u(N,) array_like

Input vector.

v(N,) array_like

Input vector.

w(N,) array_like, optional

Unused, as ‘max’ is a weightless operation. Here for API consistency.

Returns
chebyshevdouble

The Chebyshev distance between vectors u and v.

Examples

>>> from scipy.spatial import distance
>>> distance.chebyshev([1, 0, 0], [0, 1, 0])
1
>>> distance.chebyshev([1, 1, 0], [0, 1, 0])
1

Previous topic

scipy.spatial.distance.canberra

Next topic

scipy.spatial.distance.cityblock