# Projected gradient descent with matrices

I have a scalar function $$f(\rho) = Tr(\rho H) + c\ Tr(\rho\log\rho)$$, where $$Tr$$ is trace, $$\rho$$ is a positive semidefinite matrix with trace 1 and $$H$$ is a Hermitian matrix and $$c$$ is a postive constant and we are using the matrix logarithm.

I'm trying to minimize $$f$$ over all PSD $$\rho$$ with unit trace and would like to use gradient descent. Because I know my solution $$\rho$$ must have trace 1 and be positive semidefinite, I will project at each iteration onto the PSD with trace 1 subspace.

Currently, what I have tried does not work - I'm getting the wrong answer. The possibilities are

1. My gradient is incorrect. I am using $$Tr(H) + T\ Tr(\log\rho)$$ as the gradient. I derive this by assuming $$Tr(d\rho) = 0$$ so I can do it as if $$\rho$$ and $$d\rho$$ commute.
2. The projection I'm using is flawed. I am symmetrizing $$\rho$$ at each step using $$\rho = \rho + \rho^\dagger$$. I'm not sure how to project onto the positive semidefinite matrices though since $$\rho$$ is sometimes singular and I can't do $$\rho = \sqrt{\rho^\dagger\rho}$$ according to MATLAB. To keep the trace 1, I would take $$\rho = \frac{\rho}{Tr(\rho)}$$ within each step.

Can anyone point out how to approach this problem? Thank you.

• What is $\log \rho$? Is it defined for any PSD matrix $\rho$? – Bertrand Feb 22 at 11:38
• @Bertrand, yes it is defined in the following way. If a matrix is PSD, it can be diagonalized. Then take the logarithm of the diagonal entries. More details here en.wikipedia.org/wiki/Logarithm_of_a_matrix – user1936752 Feb 22 at 11:39
• Rather than the projection you have chosen, you could make use of the natural Riemannian geometry on the manifold of positive semidefinite matrices to use the adapted gradient descent algorithm in this paper: arxiv.org/abs/1111.5280 – Michael Lee Feb 22 at 13:22
• @user1936752, few not fully unrelated comments. (i) Problems may occur with $\log \rho$ if eigenvalues are equal to zero. (ii) I am not sure that Gauss-Newton iterations are helpful because the partial derivatives may not be zero at the minimum of $f$, using Nelder-Mead may be helpful. (iii) If $\rho$ is symmetric you could simplify and replace $Tr(\rho H)$ by $Tr(\Lambda H)$ with $\Lambda$ denoting the matrix of eigenvalues of $\rho$. Similarly $Tr(\rho \log \rho) = Tr(\Lambda \log \Lambda )$. This reparameterization allows minimizing $f$ over fewer parameters $\lambda$. – Bertrand Feb 22 at 16:45
• @user1936752. A one penny conjecture: a minimum is achieved for $\lambda_i \rightarrow 0, \forall i \neq K$ and $\lambda_K \rightarrow 1$ where $\lambda_K$ is the eigenvalue multiplied with the smallest diagonal element of $H$. – Bertrand Feb 22 at 16:45