Nearest (with respect to weights) symmetric positive semidefinite matrix

I want to compute the nearest symmetric positive semidefinite matrix, similar as Higham did. But here also weights (given by an inverse co-variance matrix) should be taken into account.

So the problem is as follows: Find the vector $x$ by minimizing $$(a-x)' \cdot M\cdot(a-x)$$ subject to $X$ being Hermitian/symetric and positive (semi-)definite. And with $x=vec(X)$ and $a=vec(A)$. $M$ is the inverse of a covariance-matrix, i.e. it's Hermitian/symetric and positive definite, too. $A$ and $M$ are given.
As said above, with no special weights ($M=I$, identity matrix), the problem can be solved according to Higham by setting $X$ to $A$ with all negative eigenvalues of $A$ set to $0$. I already found a numerical stable solution but I'm wondering if there is also an algebraic solution.

Any ideas? Thank you

• The mentioned simplified Higham-solution works, since $A$ is also Hermitian/symmetric (but with some negative eigenvalues). The only way I see to formally relate $a$ to $A$ is by using the properties of the Kronecker-product, i.e. $AXB=C <-> (B' \otimes A) vec(X)=vec(C)$. – Matthias Wurm Sep 19 '18 at 6:17