Broadcasting/Vectorizing inner and outer for loops in python/NumPy
问题 Purpose I have turned a double for loop into a single for loop using vectorization . I would like to now get rid of the last loop . I want to slice an Nx3 array of coordinates and calculate distances between the sliced portion and the remaining portion without using a for loop . Two cases (1) the slice is always 3x3 . (2) the slice is variable i.e., Mx3 where M is always significantly smaller than N Vectorizing the interaction of 1 row of the slice interacting with the remainder is