dist_euclidean

PURPOSE ^

Calculates the Euclidean distance between vectors [FAST].

SYNOPSIS ^

function D = dist_euclidean( X, Y )

DESCRIPTION ^

 Calculates the Euclidean distance between vectors [FAST].

 Assume X is an m-by-p matrix representing m points in p-dimensional space and Y is an
 n-by-p matrix representing another set of points in the same space. This function
 compute the m-by-n distance matrix D where D(i,j) is the SQUARED Euclidean distance
 between X(i,:) and Y(j,:).  Running time is O(m*n*p).

 If x is a single data point, here is a faster, inline version to use:
   D = sum( (Y - ones(size(Y,1),1)*x).^2, 2 )';

 INPUTS
   X   - m-by-p matrix of m p dimensional vectors 
   Y   - n-by-p matrix of n p dimensional vectors 

 OUTPUTS
   D   - m-by-n distance matrix

 EXAMPLE
   X=[randn(100,5)]; Y=randn(40,5)+2;
   D = dist_euclidean( [X; Y], [X; Y] ); im(D)

 DATESTAMP
   29-Sep-2005  2:00pm

 See also DIST_CHISQUARED, DIST_EMD

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:
Generated on Wed 03-May-2006 23:48:50 by m2html © 2003