cosineDist: Compute the cosine distance of two vectors

Description Usage Arguments Value Examples

Description

Compute the cosine distance of two vectors

Usage

1
cosineDist(a, b)

Arguments

a, b

Numerical vectors of same length

Value

The scalar product of the two input vectors divided by the product of the norms of the two input vectors

Examples

1
2
3
4
5
6
## 1. Orthogonal vectors:
cosineDist(c(1,0),c(0,1))
## 2. Non-orthogonal vectors:
cosineDist(c(1,0),c(1,1))
## Compare trigonometry:
1-cos(pi/4)

eilslabs/YAPSA documentation built on May 16, 2019, 1:23 a.m.