pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Surfing <onlinesurfing@gmail.com>
To: pgsql-sql@postgresql.org
Subject: Euclidean distance between two sets of tuples
Date: Mon, 25 Feb 2013 19:34:10 +0100
Message-ID: <512BAEA2.9040803@gmail.com> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-sql>

Hi all,
     I would like to ask if there exists a function to calculate the 
Euclidean distance between two rows of the same table.
Obviously, the distance between two non-numeric fields should be 0 if 
they are the same value, 1 otherwise.

In general, I need to compute an average distance between the subsets of 
rows, computed pairwise.
Example:
- Set 1: 10 rows
- Set 2: 15 rows
- Distances computed 150
I just need the value 1/150*(Sum of all the computed Euclidean distances).

I could write a procedure, but it would be nice if there already exists 
a function which at least computes a single Euclidean function between 
two rows.

Any suggestion?

Thank you.


-- 
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql



Message-ID: <512BAEA2.9040803@gmail.com>
Permalink:  ../512BAEA2.9040803@gmail.com/
Also on:    postgresql.org/message-id/512BAEA2.9040803@gmail.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 using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: onlinesurfing@gmail.com
  Subject: Re: Euclidean distance between two sets of tuples
  In-Reply-To: <512BAEA2.9040803@gmail.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