{ } Raw JSON

bundles / scipy 1.17.1 / scipy / spatial / _kdtree / minkowski_distance_p

function

scipy.spatial._kdtree:minkowski_distance_p

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

Signature

def   minkowski_distance_p ( x y p = 2.0 )

Summary

Compute the pth power of the L**p distance between two arrays.

Extended Summary

For efficiency, this function computes the L**p distance but does not extract the pth root. If p is 1 or infinity, this is equal to the actual L**p distance.

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

pth power of the distance between the input arrays.

Examples

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

Aliases

  • scipy.spatial.minkowski_distance_p