simplex_dist {TopicScore}R Documentation

The l_2 distance between a point and a simplex

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

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

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

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

[Package TopicScore version 0.0.1 Index]