gtm_dist {gtm}R Documentation

Calculate the squared distances between two sets of data points

Description

This function calculates distances between all data points in the two data sets T and Y and returns them in a matrix.

Usage

gtm_dist(T, Y, mode = 0)

Arguments

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

Value

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

Examples

  
  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)

[Package gtm version 1.0 Index]