compute_distance_matrix {gor} | R Documentation |
p
-distance matrix computation
Description
It computes the distance matrix of a set of n
two-dimensional points given by a n\times 2
matrix using
the distance-p
with p=2
by default.
Usage
compute_distance_matrix(z, p = 2)
Arguments
z |
A |
p |
The |
Details
Given a set of n
points \{z_j\}_{j=1,...,n}
, the
distance matrix is a n\times n
symmetric matrix with
matrix elements
d_{ij} = d(z_i,z_j)
computed using the
distance-p
given by
d_p(x,y) = \left(\sum_i
(x_i-y_i)^p\right)^{\frac{1}{p}}
.
Value
The distance-p
of the points.
Author(s)
Cesar Asensio
See Also
compute_p_distance computes the distance-p
,
compute_tour_distance computes tour distances. A distance
matrix can also be computed using dist.
Examples
set.seed(1)
n <- 25
z <- cbind(runif(n,min=1,max=10),runif(n,min=1,max=10))
d <- compute_distance_matrix(z)
[Package gor version 1.0 Index]