Home > vbmeg > functions > common > utility > vb_mutual_distance.m

vb_mutual_distance

PURPOSE ^

calculate distance between points

SYNOPSIS ^

function dd = vb_mutual_distance(X)

DESCRIPTION ^

 calculate distance between points
  dd = vb_mutual_distance(X)
 --- Input
 X : N point coordinate [ N x D ]
 --- Output
 dd(n,m) : distance between X(n.:) and X(m,:)

 Copyright (C) 2011, ATR All Rights Reserved.
 License : New BSD License(see VBMEG_LICENSE.txt)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function    dd = vb_mutual_distance(X)
0002 % calculate distance between points
0003 %  dd = vb_mutual_distance(X)
0004 % --- Input
0005 % X : N point coordinate [ N x D ]
0006 % --- Output
0007 % dd(n,m) : distance between X(n.:) and X(m,:)
0008 %
0009 % Copyright (C) 2011, ATR All Rights Reserved.
0010 % License : New BSD License(see VBMEG_LICENSE.txt)
0011 
0012 [N, D] = size(X);
0013 
0014 dd = zeros(N,N);
0015 
0016 for n=1:N
0017     dd(:,n) = sqrt( sum( vb_repadd(X , - X(n,:)).^2 , 2) );
0018 end

Generated on Mon 22-May-2023 06:53:56 by m2html © 2005