Group: | Linear Algebra |
See also: | agglom bindata grid |
Function: | distance | |
Description: | distance computes the distance between p-dimensional datapoints depending on a specified metric. |
Usage: | d = distance (x {, metric}) | |
Input: | ||
x | n x p matrix | |
metric | string indentifying the metric name | |
Output: | ||
d | symmetric n x n matrix of pairwise distances |
If no metric is specified, l2 is used.
x = #(1,4)~#(1,5) distance(x, "l1") distance(x, "l2") distance(x, "maximum")
Contents of distance [1,] 0 7 [2,] 7 0 Contents of distance [1,] 0 5 [2,] 5 0 Contents of distance [1,] 0 4 [2,] 4 0