Have you seen the Distance package?

https://github.com/JuliaStats/Distance.jl

-- mb


On Wed, Jun 4, 2014 at 7:44 AM, Carlos Baptista <[email protected]> wrote:

> 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
>
>

Reply via email to