This is a pre-release version (2.0.0.dev0+git20260907.41eeb59).Go to latest (1.18.0)
{ } Raw JSON

bundles / scipy 2.0.0.dev0+git20260907.41eeb59 / scipy / spatial / _kdtree / minkowski_distance_p

function

scipy.spatial._kdtree:minkowski_distance_p

source: build-install/usr/lib/python3.14/site-packages/scipy/spatial/_kdtree.py:16

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.

Notes

Array API Standard Support

minkowski_distance_p is not in-scope for support of Python Array API Standard compatible backends other than NumPy.

See dev-arrayapi for more information.

Examples

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

Aliases

  • scipy.spatial.minkowski_distance_p