compute_distance_matrix {gor}R Documentation

pp-distance matrix computation

Description

It computes the distance matrix of a set of nn two-dimensional points given by a n×2n\times 2 matrix using the distance-pp with p=2p=2 by default.

Usage

compute_distance_matrix(z, p = 2)

Arguments

z

A n×2n\times 2 matrix with the two-dimensional points

p

The pp parameter of the distance-pp. It defaults to 2.

Details

Given a set of nn points {zj}j=1,...,n\{z_j\}_{j=1,...,n}, the distance matrix is a n×nn\times n symmetric matrix with matrix elements

dij=d(zi,zj)d_{ij} = d(z_i,z_j)

computed using the distance-pp given by

dp(x,y)=(i(xiyi)p)1pd_p(x,y) = \left(\sum_i (x_i-y_i)^p\right)^{\frac{1}{p}}

.

Value

The distance-pp of the points.

Author(s)

Cesar Asensio

See Also

compute_p_distance computes the distance-pp, 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]