gtm_dstg

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 via the global variable matrix gtmGlobalDIST.

In addition, the minimum and maximum value of each column in gtmGlobalDIST may be calculated and returned via the global variables gtmGlobalMinDist and gtmGlobalMaxDist.

Synopsis

gtm_dstg(T, Y, m)
gtm_dstg(T, Y)

Arguments

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; the default mode is m = 0 (see gtmGlobalMinDist/MaxDist below)

Global variables

gtmGlobalDIST - Matrix containing the calculated distances; dimension K-by-N; DIST(k,n) contains the squared distance between T(n,:) and Y(k,:). This matrix is assumed to be pre-allocated; if this is not the case, performance deteriorates dramatically

gtmGlobalMinDist, gtmGlobalMaxDist - vectors containing the minimum and maximum of each column in DIST, respectively; 1-by-N; calculated iff m > 0.

Notes

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. A mex-file implementation will have pre-allocated global matrices as an absolute requirement.

See also

gtm_dist


The GTM Toolbox: Contents