dist

From STX Wiki
< Programmer Guide‎ | Command Reference‎ | EVAL
Revision as of 14:05, 17 May 2010 by 193.171.195.8 (talk) (initial import)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search
dist

Calculate the distance matrix for all elements in the vector x or for all row vectors in the matrix x. I.e. d(i,j) = distance (x[i,*], x[j,*]). This is a subcommand of the EVAL command.

Usage:

dist(x)

Return Type:

matrix

Calculate the Euclidean distance from x to y. Both arguments must be either scalars or vectors.

Usage:

dist(x, y)

Return Type:

scalar

Calculate the Euclidean distances between all elements of xv or all row vectors of xm to the value ys or the vector yv. The result is a vector with x[!nrow] elements.

Usage:

dist(xv,ys)

dist(xm, yv)

Return Type:

vector

Navigation menu

Personal tools