SciPy

scipy.spatial.minkowski_distance

scipy.spatial.minkowski_distance(x, y, p=2)[source]

Compute the L**p distance between two arrays.

Parameters
x(M, K) array_like

Input array.

y(N, K) array_like

Input array.

pfloat, 1 <= p <= infinity

Which Minkowski p-norm to use.

Examples

>>> from scipy.spatial import minkowski_distance
>>> minkowski_distance([[0,0],[0,0]], [[1,1],[0,1]])
array([ 1.41421356,  1.        ])

Previous topic

scipy.spatial.distance_matrix

Next topic

scipy.spatial.minkowski_distance_p