TITLE: Finding a matrix from its diagonal and the off-diagonal elements of its inverse?
QUESTION [8 upvotes]: This question comes from https://stats.stackexchange.com/questions/457375/recover-full-covariance-matrix-from-covariance-diagonal-and-precision-off-diagon  where it have not found answers. So, let $\Sigma$ be an $N\times N$ covariance (that is, positive semidefinite) matrix, but we do only know its diagonal and the off-diagonal elements of its inverse $\Sigma^{-1}$ (known as precision matrix).
How can we find $\Sigma$ effectively?

REPLY [2 votes]: Following the ideas from my answer to Carlo's question, let $M(z_1, \ldots, z_n)$ be the symmetric matrix with $M(z_1, \ldots, z_n)_{ij} = \Sigma_{ij}$ for $i \neq j$ and $M(z_1, \ldots, z_n)_{ii} = z_i$.
Use any sort of numerical optimization algorithm to maximize
$$\log \det M(z_1, \ldots, z_n) - \sum_{i=1}^n \Sigma^{-1}_{ii} z_i$$
on the open set of $(z_1, \ldots, z_n)$ where $M(z_1, \ldots, z_n)$ is positive definite. The function in question is concave, so the optimum is unique and shouldn't be hard to find. This $M(z_1,\ldots, z_n)$ will have the desired property.
The equations one gets seems to have fairly high degree, so I would not attempt a symbolic solution.