How to Project a Symmetric Matrix onto the Cone of Positive Semi Definite (PSD) Matrices How would you project a symmetric real matrix onto the cone of all positive semi-definite matrices?
 A: 
"A matrix M is positive semi-definite if and only if there is a
  positive semi-definite matrix B with B2 = M. This matrix B is
  unique,[6] is called the square root of M, and is denoted with B =
  M1/2 (the square root B is not to be confused with the matrix L in the
  Cholesky factorization M = LL*, which is also sometimes called the
  square root of M). If M > N > 0 then M1/2 > N1/2 > 0."
[6]  Horn & Johnson (1985), Theorem 7.2.6 with k = 2
Horn, Roger A.; Johnson, Charles R. (1990), Matrix Analysis, Cambridge
  University Press, ISBN 978-0-521-38632-6.

http://en.wikipedia.org/wiki/Positive-semidefinite_matrix
So, given symmetric $A,$ we have $A^2 = A A^T$ is symmetric positive semidefinite and has just one p.s.d. square root. So your projection is $$  A \mapsto \sqrt{A^2}   $$
Meanwhile, if $A$ is already p.s.d., already in the cone, then $A \mapsto A,$ which is what you want for something called a projection. 
A: If you merely want to find a projection $\pi$ such that $\pi(S)$ is positive semidefinite for some fixed real symmetric matrix $S$, you may first orthogonally diagonalise $S$ as $QDQ^\top$ and then define $\pi: M\mapsto Q\Sigma Q^\top M$, where $\Sigma$ is a 0-1 diagonal matrix whose $i$-th diagonal entry is $1$ if the $i$-th diagonal entry of $D$ is nonnegative, and $0$ otherwise.
