DistanceMatrix

DistanceMatrix[{u1,u2,}]

gives the matrix of distances between each pair of elements ui, uj.

DistanceMatrix[{u1,u2,},{v1,v2,}]

gives the matrix of distances between each pair of elements ui, vj.

Details and Options

Examples

open allclose all

Basic Examples  (3)

Compute a distance matrix from a list of integers:

In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]//MatrixForm=

Compute a distance matrix from two lists of integers:

In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]//MatrixForm=

Compute a distance matrix from real-valued numerical vectors:

In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]//MatrixForm=

Scope  (10)

Options  (8)

Applications  (1)

See Also

Outer  NearestNeighborGraph  AdjacencyMatrix  GraphDistanceMatrix  Nearest  Norm  ClusterClassify  FindClusters  DistanceFunction

Introduced in 2015
(10.3)
| Updated in 2017
(11.2)