Pairwise distance.
procedure PairwiseDistance(const X: TMtx; const D: TMtx; p: Integer; const Method: TPWDistMethod = pwdistEuclidian); overload;
Calculates the pairwise distance for variables, stored in X.
Suppose we have collected 5 data points with 3 variables. The data matrix will look like:
X=[2,1,3, 2,3,1, 4,5,6, 6,6,6 7,5,3]
To calculate Euclidian distance between each pair of points, we use the following code:
PairWiseDistance(X,D,3); // 3 dimensions for 3 variables
Generated distance matrix has zero diagonal and is always symmetric.
Copyright (c) 1999-2025 by Dew Research. All rights reserved.
|
What do you think about this topic? Send feedback!
|