For each point in 3D, I want to get its distance from all points across the same dimension. Something along these lines but vectorized:
points = np.array([[1, 2], [-2, 4], [6, -1]])
dims, num_points = points.shape
dist = np.zeros((dims, num_points, num_points))
for d in range(dims):
for i in range(num_points):
for j in range(num_points):
dist[d][i][j] = points[d][i] - points[d][j]
...
>>> dist
array([[[ 0., -1.],
[ 1., 0.]],
[[ 0., -6.],
[ 6., 0.]],
[[ 0., 7.],
[-7., 0.]]])