Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #12375

Re: Euclidean distance of all pairwise combinations (redundants)

From Ray Koopman <koopman@sfu.ca>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: Euclidean distance of all pairwise combinations (redundants)
Date 2012-11-18 09:03 +0000
Message-ID <k8a88t$89l$1@smc.vnet.net> (permalink)
References <k7ve05$s08$1@smc.vnet.net>
Organization Time-Warner Telecom

Show all headers | View raw


On Nov 13, 10:35 pm, Jesse Pisel <jessepi...@gmail.com> wrote:
> I have been having a tough time trying to figure out how to include all red undant pairwise combinations in my results for the euclidean distance between a set of points. I have a set of points with xy coordinates and want the euclidean distance between each point including the point and itself. So if my points in xy space are list = {{1, 1}, {2, 2}, {3, 3}} for example, I want the distance from {1, 1} to {1, 1}, {1, 1} to {2, 2}, and {2, 2} to {3, 3} etc. for each point for a total of 9 distances all together. The EuclideanDistance function removes the redundant distances that I want retained in the results. I have been using this code just to play with data but would like to be able to expand up to 500+ points:
>
> list = {{1, 1}, {2, 2}, {3, 3}}
> EuclideanDistance @@@ Subsets[list, {2}]
>
> Any ideas on how to get the euclidean distance between all the points including redundants and self references?

If your lists are long then it will be faster to use

Needs["HierarchicalClustering`"]

Flatten@DistanceMatrix[list, DistanceFunction -> EuclideanDistance]

Back to comp.soft-sys.math.mathematica | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Euclidean distance of all pairwise combinations (redundants) Jesse Pisel <jessepisel@gmail.com> - 2012-11-14 06:33 +0000
  Re: Euclidean distance of all pairwise combinations (redundants) "Nasser M. Abbasi" <nma@12000.org> - 2012-11-15 09:07 +0000
  Re: Euclidean distance of all pairwise combinations (redundants) Ray Koopman <koopman@sfu.ca> - 2012-11-18 09:03 +0000
  Re: Euclidean distance of all pairwise combinations (redundants) vasiliadesmixalis@gmail.com - 2013-02-01 01:46 +0000
    Re: Euclidean distance of all pairwise combinations (redundants) Ray Koopman <koopman@sfu.ca> - 2013-02-01 06:16 +0000
  Re: Euclidean distance of all pairwise combinations (redundants) Francisco Gutierrez <fgutiers2002@yahoo.com> - 2013-02-01 06:15 +0000
  Re: Euclidean distance of all pairwise combinations (redundants) Bob Hanlon <hanlonr357@gmail.com> - 2013-02-01 06:16 +0000

csiph-web