cosineMatchDist: Compute an altered cosine distance of two vectors

Description Usage Arguments Value Examples

View source: R/basic_functions.R

Description

This is an altered cosine distance: it first reduced the dimension of the two input vectors to only those coordinates where both have non-zero entries. The cosine similarity is then computed on these reduced vectors, i.e. on a sub-vector space.

Usage

1

Arguments

a, b

Numerical vectors of same length

Value

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

Examples

1
2
3
4
## 1. Orthogonal vectors:
cosineMatchDist(c(1,0),c(0,1))
## 2. Non-orthogonal vectors:
cosineMatchDist(c(1,0),c(1,1))

YAPSA documentation built on Nov. 8, 2020, 4:59 p.m.