I would like to calculate the vector between points as fast as possible. My Input array has a list of points in 3D. And looks like this
b = [[0,0,1], #first point
[1,0,2], #second point
... ]
I want to calculate a matrix with the vector as entry (m_ij = b_i - b_j) and it should look like this:
m = [[[0,0,0], [-1,0,-1],...],
[[1,0,1], [0,0,0],...],
... ]
How do I calculate this with built in functions of numpy and scipy without using any slow loops? I found pdist, but this uses a metric and I don't think it really fits my needs.
Use broadcasting:
Output:
Shapes: