gammy.utils.squared_dist

squared_dist

squared_dist(x1, x2)numpy.ndarray[source]

Squared distance matrix for column array of N-dimensional points

Parameters
x1np.ndarray

1-D Column array

x2np.ndarray

1-D Column array

Examples

x = np.array([[0], [1], [2]])
squared_dist(x, x)
# array([[0, 1, 4],
#        [1, 0, 1],
#        [4, 1, 0]])