PiW: Projection onto the standard simplex

View source: R/PiW.R

PiWR Documentation

Projection onto the standard simplex

Description

The input vector is projected onto the standard simplex, i.e. the set of vectors of the same length as the input vector with non-negative entries that sum to 1.

Usage

PiW(v)

Arguments

v

Input vector

Details

This is an auxiliary function used by the InspectChangepoint package.

Value

A vector in the standard simplex that is closest to the input vector is returned.

References

Chen, Y. and Ye, X. (2011) Projection onto a simplex. arXiv preprint, arxiv:1101.6081.

Examples

v <- rnorm(10)
PiW(v)

InspectChangepoint documentation built on May 3, 2022, 9:07 a.m.