'How to get distances between 2 xyz numpy arrays without loop?
Suppose I have 2 numpy arrays containing xyz coordinates of points. Each point's coordinates is a row.
a
[0 1 0]
[3 1 0]
[0 0 3]
[3 4 0]
[0 2 0]
[2 3 4]
[0 1 2]
[0 3 2]
b
[1 1 2]
[1 1 2]
[0 2 2]
[4 2 1]
[4 4 4]
Is it possible to calculate the distance (sqrt((x1-x2)**2+(y1-y2)**2+(z1-z2)**2)) from each point of a to each point of b without a double for loop?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
