Calculate the squared distances between two sets of data points.
This function calculates distances between all data points in the two data sets T and Y and returns them in a matrix.
[DIST, minDist, maxDist] = gtm_dist(T, Y, m)
[DIST] = gtm_dist(T, Y)
T, Y
- data set matrices in which each row is a data point; dimensions N-by-D and K-by-D respectively
m
- mode of calculation; iff m > 0, min- and maxDist (below) are calculated; the default mode
is 0
DIST
- matrix containing the calculated distances; dimension K-by-N; DIST(k,n) contains the squared
distance between T(n,:) and Y(k,:).
minDistmaxDist
- vectors containing the minimum and maximum of each column in DIST, respectively;
1-by-N; required iff m > 0.
This m-file provides this help comment and a MATLAB implementation of the distance calculation. If, however, a mex-file with the same name is present in the MATLABPATH, this will be called for doing the calculation. As this is a computationally demanding step of the algorithm, an efficient mex-file implementation will improve the performance of the GTM training algorithm.