PathScripts.kdtree Namespace Reference

class  KDTree

class  Rectangle

## Functions

def distance_matrix (x, y, p=2, threshold=1000000)

def minkowski_distance (x, y, p=2)

def minkowski_distance_p (x, y, p=2)

## Function Documentation

 def PathScripts.kdtree.distance_matrix ( x, y, p = `2`, threshold = `1000000` )
```Compute the distance matrix.

Returns the matrix of all pair-wise distances.

Parameters
----------
x : (M, K) array_like
TODO: description needed
y : (N, K) array_like
TODO: description needed
p : float, 1 <= p <= infinity
Which Minkowski p-norm to use.
threshold : positive int
If ``M * N * K`` > `threshold`, algorithm uses a Python loop instead
of large temporary arrays.

Returns
-------
result : (M, N) ndarray
Distance matrix.

Examples
--------
>>> distance_matrix([[0,0],[0,1]], [[1,0],[1,1]])
array([[ 1.        ,  1.41421356],
[ 1.41421356,  1.        ]])```

References PathScripts.kdtree.minkowski_distance().

 def PathScripts.kdtree.minkowski_distance ( x, y, p = `2` )
```Compute the L**p distance between two arrays.

Parameters
----------
x : (M, K) array_like
Input array.
y : (N, K) array_like
Input array.
p : float, 1 <= p <= infinity
Which Minkowski p-norm to use.

Examples
--------
>>> minkowski_distance([[0,0],[0,0]], [[1,1],[0,1]])
array([ 1.41421356,  1.        ])```

References PathScripts.kdtree.minkowski_distance_p().

 def PathScripts.kdtree.minkowski_distance_p ( x, y, p = `2` )
```Compute the p-th 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.

Parameters
----------
x : (M, K) array_like
Input array.
y : (N, K) array_like
Input array.
p : float, 1 <= p <= infinity
Which Minkowski p-norm to use.

Examples
--------
>>> minkowski_distance_p([[0,0],[0,0]], [[1,1],[0,1]])
array([2, 1])```

Referenced by PathScripts.kdtree.minkowski_distance().