Code covered by the BSD License  

Highlights from
Projection onto simplex

5.0 | 1 rating Rate this file 30 Downloads (last 30 days) File Size: 1.69 KB File ID: #30332 Version: 1.2

Projection onto simplex



08 Feb 2011 (Updated )

This program computes the projection onto the canonical simplex

| Watch this File

File Information

This program computes the projection of any n-dimensional vector y onto the canonical simplex Dn defined by Dn:={x: x n-dimensional vector, 0<=x<=1, sum(x(:))=1 }. Namely, it solves x=arg min_x |x-y| subject to the constraint that x is in Dn.

x = projsplx(y);

Explanation of the algorithm can be found at

C code and pre-compiled mex files can be found at the author's website.


This file inspired Stochastic Matrix Projection(A,Projection Type).

MATLAB release MATLAB 7.6 (R2008a)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (1)
09 Nov 2012 Wok

Wok (view profile)

11 Feb 2011 1.2

update description. improve the code efficiency

Contact us