{ } Raw JSON

bundles / scipy latest / scipy / spatial / _kdtree / minkowski_distance

function

scipy.spatial._kdtree:minkowski_distance

source: /scipy/spatial/_kdtree.py :63

Signature

def   minkowski_distance ( x y p = 2.0 )

Summary

Compute the L**p distance between two arrays.

Extended Summary

The last dimensions of x and y must be the same length. Any other dimensions must be compatible for broadcasting.

Parameters

x : (..., K) array_like

Input array.

y : (..., K) array_like

Input array.

p : float, 1 <= p <= infinity

Which Minkowski p-norm to use.

Returns

dist : ndarray

Distance between the input arrays.

Examples

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

Aliases

  • scipy.spatial.minkowski_distance