dists:

--------------------------------------------------------------------------
   Calculates distances between vectors of points.

   Since version 7.
--------------------------------------------------------------------------
   Form:
   D = dists(X1,X2,p,e)
--------------------------------------------------------------------------

   ------
   Inputs
   ------  
   X1  = n x d matrix of n d-dimensional points
   X2  = m x d matrix of m d-dimensional points
   p   = 2, Euclidean (default): D(i,j) = sqrt(sum((X1(i,:) - X2(j,:))^2))
       = 1, rectilinear: D(i,j) = sum(abs(X1(i,:) - X2(j,:))
       = Inf, Chebychev dist: D(i,j) = max(abs(X1(i,:) - X2(j,:))
       = (1 Inf), lp norm: D(i,j) = sum(abs(X1(i,:) - X2(j,:))^p)^(1/p)
       = 'rad', great circle distance in radians of a sphere
         (where X1 and X2 are decimal degree latitudes and longitudes)  
       = 'mi' or 'sm', great circle distance in statute miles on the earth
       = 'km', great circle distance in kilometers on the earth
   e   = epsilon for hyperboloid approximation gradient estimation
       = 0 (default); no error checking if any non-empty 'e' input
       ~= 0 => general lp used for rect., Cheb., and p outside [1,2] 

   -------
   Outputs
   -------
   D   = n x m matrix of distances
       = (n-1) x 1 vector of distances between X1 points, if X2 = []

--------------------------------------------------------------------------