This mini-paper presents a fast and simple algorithm to compute the
projection onto the canonical simplex â–³n. Utilizing the Moreau's
identity, we show that the problem is essentially a univariate minimization and
the objective function is strictly convex and continuously differentiable.
Moreover, it is shown that there are at most n candidates which can be computed
explicitly, and the minimizer is the only one that falls into the correct
interval