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


Groups > comp.lang.python > #98028

Re: Nearest neighbours of points

Path csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail
From Terry Reedy <tjreedy@udel.edu>
Newsgroups comp.lang.python
Subject Re: Nearest neighbours of points
Date Sat, 31 Oct 2015 23:00:54 -0400
Lines 18
Message-ID <mailman.6.1446346873.4463.python-list@python.org> (permalink)
References <81947104-f6dd-48b3-ba7b-f03b0c5b6f39@googlegroups.com> <d9kq38Ft8k9U1@mid.individual.net>
Mime-Version 1.0
Content-Type text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding 7bit
X-Trace news.uni-berlin.de ppmo0BL4Zo3Oci8RnryfdA8XLQBLhO7bhu/yXBpIe4fw==
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.000
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'converts': 0.07; 'linear': 0.07; 'smallest': 0.07; 'tom': 0.07; 'indexes': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'rows': 0.09; 'stored': 0.10; 'jan': 0.11; 'index': 0.13; '10:05': 0.16; 'formula': 0.16; 'received:80.91.229.3': 0.16; 'received:io': 0.16; 'received:plane.gmane.org': 0.16; 'received:psf.io': 0.16; 'reedy': 0.16; 'symmetric': 0.16; 'triangle': 0.16; 'wrote:': 0.16; '(see': 0.20; 'gather': 0.22; 'header:In-Reply-To:1': 0.24; 'header:User-Agent:1': 0.26; 'example': 0.26; 'header:X -Complaints-To:1': 0.26; 'points': 0.27; 'point': 0.33; 'list': 0.34; 'but': 0.36; 'should': 0.36; 'depends': 0.36; 'to:addr :python-list': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'two': 0.37; 'received:org': 0.37; 'list.': 0.37; 'minimum': 0.38; 'represent': 0.38; 'to:addr:python.org': 0.40; 'upper': 0.76; 'distances': 0.84; 'matrix.': 0.84; 'distance.': 0.91; 'received:fios.verizon.net': 0.91
X-Injected-Via-Gmane http://gmane.org/
X-Gmane-NNTP-Posting-Host pool-173-59-124-74.phlapa.fios.verizon.net
User-Agent Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0
In-Reply-To <d9kq38Ft8k9U1@mid.individual.net>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.20+
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Xref csiph.com comp.lang.python:98028

Show key headers only | View raw


On 10/31/2015 5:28 PM, Tom P wrote:
> On 10/24/2015 10:05 PM, Poul Riis wrote:
>> I have N points in 3D, organized in a list. I want to to point out the
>> numbers of the two that have the smallest distance.
>> With scipy.spatial.distance.pdist I can make a list of all the
>> distances, and I can point out the number of the minimum value of that
>> list (see simple example below

distances is conceptually a 2-d matrix, but since it would be 
symmetrical, I gather that it is stored as 1-d represention  You should 
be able to find the formula that converts the linear index to the 
indexes of the corresponding symmetric matrix.  It depends on whether 
distances represent the upper or lower triangle of the symmetric matrix 
and whether the triangular matrix is stored by rows or columns.

-- 
Terry Jan Reedy

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Nearest neighbours of points Poul Riis <priisdk@gmail.com> - 2015-10-24 13:05 -0700
  Re: Nearest neighbours of points Christian Gollwitzer <auriocus@gmx.de> - 2015-10-24 22:45 +0200
  Re: Nearest neighbours of points Poul Riis <priisdk@gmail.com> - 2015-10-24 15:44 -0700
    Re: Nearest neighbours of points Christian Gollwitzer <auriocus@gmx.de> - 2015-10-25 09:55 +0100
      Re: Nearest neighbours of points Poul Riis <priisdk@gmail.com> - 2015-10-25 05:00 -0700
      Re: Nearest neighbours of points Peter Pearson <pkpearson@nowhere.invalid> - 2015-10-25 17:01 +0000
    Re: Nearest neighbours of points Bartc <bc@freeuk.com> - 2015-10-25 12:36 +0000
  Re: Nearest neighbours of points Fabien <fabien.maussion@gmail.com> - 2015-10-26 03:25 +0100
  Re: Nearest neighbours of points Tom P <werotizy@freent.dd> - 2015-10-31 22:28 +0100
    Re: Nearest neighbours of points Terry Reedy <tjreedy@udel.edu> - 2015-10-31 23:00 -0400

csiph-web