minkowski: Minkowski distance matrice between points

Description Usage Arguments Value Examples

View source: R/minkowski.R

Description

Computes the Minkowski distance between n points in m dimensions ,or two points with same dimensions.

Usage

1
minkowski(x, y, p, w = 1, output = "matrix")

Arguments

x

Numeric vector, or a matrix with size n x m.

y

(optional)Numeric vector; must be the same length as x. If no input of y, please specify all other parameters to avoid confusion.

p

Non-zero numeric value

w

Numeric value greater than 0, account for weight. Default is 1.

output

Format of output, either matrix or dist object. Default is matrix.

Value

Minkowski distance matrix or object calculated by sum(|x - y|^p * w) ^ (1/p) between points

Examples

1
2
3
minkowski(x = matrix(c(1, 2, 3, 4), 2, 2), p = 2, w = 0.5, output = "dist")

minkowski(rnorm(10), rnorm(10), 0.5, 2)

yingtliu/distPack documentation built on Jan. 1, 2021, 1:45 p.m.