gtm_dist {gtm} | R Documentation |
This function calculates distances between all data points in the two data sets T and Y and returns them in a matrix.
gtm_dist(T, Y, mode = 0)
T,Y |
data set matrices in which each row is a data point; dimensions N-by-D and K-by-D respectively |
mode |
mode of calculation; iff m > 0, min- and maxDist (below) are calculated; the default mode is 0 |
if m == 0 then DIST
- matrix containing the calculated distances;
dimension K-by-N; DIST(k,n) contains the squared distance between T(n,:) and Y(k,:).
if m > 0 then a list containing matrix DIST
, minDist
,
maxDist
, the latter two being
vectors containing the minimum and maximum of each column in DIST, respectively; 1-by-N
A = matrix(c(1,3,4,2,0,-1), ncol=2) A B = matrix(c(1,0,0,1), ncol=2) gtm_dist(A, B) gtm_dist(A, B ,1)