Euclidean distance between two sets of tuples - Mailing list pgsql-sql

From Surfing
Subject Euclidean distance between two sets of tuples
Date
Msg-id 512BAEA2.9040803@gmail.com
Whole thread Raw
List pgsql-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.



pgsql-sql by date:

Previous
From: Don Parris
Date:
Subject: Using Ltree For Hierarchical Structures
Next
From: mkumbale
Date:
Subject: Creating a new database with a TEMPLATE did not work