# How to do gradient descent when parameter is positive definite matrix

So, suppose I have an objective function $$\mathcal{L}(\Sigma)$$ where $$\Sigma$$ is a positive definite matrix. Now, I want to optimize this function using gradient descent. Now, I think if I compute the gradient and write the update equation for $$\Sigma$$, the positive definite constraint may not be maintained. How can I be sure that the optimum I get is also at a pd matrix.

This problem occurs prominently in for instance estimation of mixed models. The R packages nlme and lme4 and certainly others use the log-Cholesky parameterization of the positive definite covariance matrix(ices).
If the matrix is size 3 for example, the logarithm will have 6 free parameters; in general $$n(n+1)/2$$ parameters are needed for the logarithm. Define the function to optimize over these parameters for the logarithm of the matrix, then use the matrix exponential to find the corresponding positive definite matrix you use in the objective function.