I have a vector centroids
of size n
and a vector points
of size p
(both of these are actually Vx3
matrices, where V
is the number of points or centroids).
For any given point pt
from points
, I want to generate another vector of distances: the distance of pt
from each centroid.
Is there any functional-programming style way of doing this? Something like this, maybe (Python-style):
distances = [ norm(pt - c) for c in centroids ]
If not, what is the nicest way for me to do this? I'm using Octave, but I added the matlab tag as well since the languages are quire similar (from what I can see, at least).