cosineDist {YAPSA}R Documentation

Compute the cosine distance of two vectors

Description

Compute the cosine distance of two vectors

Usage

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. 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)


[Package YAPSA version 1.19.0 Index]