← Back
Editing: _kdtree.cpython-311.pyc
� d�c�� � �t � d dl ZddlmZmZ g d�Zdd�Zdd�Z G d� d � � Z G d � de� � Z dd �Z dS )� N� )�cKDTree�cKDTreeNode)�minkowski_distance_p�minkowski_distance�distance_matrix� Rectangle�KDTree� c �> � t j | � � } t j |� � }t j t j | j |j � � d� � }| � |� � } |� |� � }|t j k r+t j t j || z � � d�� � S |dk r+t j t j || z � � d�� � S t j t j || z � � |z d�� � S )aH Compute the pth power of the L**p distance between two arrays. 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]]) array([2, 1]) �float64���)�axisr ) �np�asarray� promote_types�dtype�astype�inf�amax�abs�sum)�x�y�p�common_datatypes �7/usr/lib/python3/dist-packages/scipy/spatial/_kdtree.pyr r s� � �>