pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Joe Conway <mail@joeconway.com>
To: Bruno Wolff III <bruno@wolff.to>
Cc: Virgile Beddok <virgile.beddok@igd.fraunhofer.de>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Christopher Kings-Lynne <chriskl@familyhealth.com.au>
Cc: pgsql-novice@postgresql.org
Cc: pgsql-advocacy@postgresql.org
Subject: Re: [NOVICE] Function which gives back the nearest
Date: Mon, 28 Mar 2005 09:23:15 -0800
Message-ID: <42483D83.4030209@joeconway.com> (raw)
In-Reply-To: <20050328172223.GA11567@wolff.to>
References: <2657.146.140.8.144.1111775776.squirrel@webmail.igd.fraunhofer.de>
	<42464392.9040903@familyhealth.com.au>
	<20050327163653.GH9280@wolff.to>
	<5796.1111941132@sss.pgh.pa.us>
	<1218.146.140.8.94.1112025141.squirrel@webmail.igd.fraunhofer.de>
	<20050328161240.GD7217@wolff.to>
	<1343.146.140.8.94.1112027529.squirrel@webmail.igd.fraunhofer.de>
	<20050328172223.GA11567@wolff.to>

Bruno Wolff III wrote:
> On Mon, Mar 28, 2005 at 18:32:09 +0200,
>   Virgile Beddok <virgile.beddok@igd.fraunhofer.de> wrote:
> 
>>I just want to know if there is an existing and implemented function, or
>>tree, in Postgres which allows me to directly perform a "nearest neighbour
>>search" on multidimensional vectors.
> 
> 
> How are you measuring distance? (i.e. Euclidean distance isn't the only
> metric that you could be using.)
> 
> Earthdistance has functions for doing this using geodesics on the surface
> of a sphere.
> 
> For 2D, I think there is a function on "point"s that uses Euclidean
> distance.
> 
> I don't think this is the hard part of your problem. It is easy to create
> a metric function and get the point corresponding to the minimal value
> using a sort. Being able to limit the sets of points looked at is the
> hard part.

You might want to look into using R:
http://www.bioconductor.org/CRAN/
(see "Packages")

perhaps through PL/R:
http://www.joeconway.com/plr/

or RdbiPgSQL:
http://www.bioconductor.org/repository/release1.5/package/html/RdbiPgSQL.html

Joe



Message-ID: <42483D83.4030209@joeconway.com>
Permalink:  ../42483D83.4030209@joeconway.com/
Also on:    postgresql.org/message-id/42483D83.4030209@joeconway.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: mail@joeconway.com, bruno@wolff.to, virgile.beddok@igd.fraunhofer.de, tgl@sss.pgh.pa.us, chriskl@familyhealth.com.au, pgsql-novice@postgresql.org, pgsql-advocacy@postgresql.org
  Subject: Re: [NOVICE] Function which gives back the nearest
  In-Reply-To: <42483D83.4030209@joeconway.com>
  References: <2657.146.140.8.144.1111775776.squirrel@webmail.igd.fraunhofer.de> <42464392.9040903@familyhealth.com.au> <20050327163653.GH9280@wolff.to> <5796.1111941132@sss.pgh.pa.us> <1218.146.140.8.94.1112025141.squirrel@webmail.igd.fraunhofer.de> <20050328161240.GD7217@wolff.to> <1343.146.140.8.94.1112027529.squirrel@webmail.igd.fraunhofer.de> <20050328172223.GA11567@wolff.to> <42483D83.4030209@joeconway.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox