cos_dis: Cosine distance matrice between points

Description Usage Arguments Value Examples

Description

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

Usage

1
cos_dis(x, y, 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.

output

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

Value

Cosine distance matrix or object calculated by 1 - dot(x, y) / (norm(x) * norm(y)) between points

Examples

1
2
3
cos_dis(x = matrix(c(1, 2, 3, 4), 2, 2), output = "dist")

cos_dis(rnorm(10), rnorm(10))

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