simplex_dist: The l_2 distance between a point and a simplex

Description Usage Arguments Value Author(s) References Examples

Description

This function computes the l_2 distance between a point and a simplex, that is the shortest l_2 distance between the given point and any point in the simplex.

Usage

1
simplex_dist(theta, V)

Arguments

theta

A (K-1) dimensional vector, representing a point.

V

The K-by-(K-1) vertices matrix, with each row being a vertex.

Value

The l_2 distance.

Author(s)

Minzhe Wang

References

Ke, Z. T., & Wang, M. (2017). A new SVD approach to optimal topic estimation. arXiv preprint arXiv:1704.07016.

Examples

1
2
3
4
5
# Generate 3 vertices
V <- rbind(c(-1/2,-1/2), c(1,0), c(0,1))

theta <- c(3,1)
simplex_dist(theta, V)

TopicScore documentation built on June 6, 2019, 5:06 p.m.