Let's say I have two sets of points in a 3-dimensional space represented by
arrays of sizes Nx3 and Mx3. What is the most efficient way to calculate
the distances between all points of set 1 against all points of set 2?
This is a (not so efficient example) of what I want to accomplish:
function euclidean_distance(pointA::AbstractMatrix, pointB::AbstractMatrix)
N = size(pointA, 1)
M = size(pointB, 1)
D = zeros(N, M)
for j = 1:M
for i = 1:N
D[i, j] = norm(pointA[i, :] - pointB[j, :])
end
end
return D
end