# Derivative of a diagonal matrix w.r.t. a vector

Let $a, b$ be $n \times 1$ vectors, $\Sigma$ an $n \times n$ matrix, $P$ an $n \times d$ matrix, and $w$ an $d \times 1$ vector. How do you calculate $\mathrm d\left(a^T \Sigma^{-1} b \right)/\mathrm d w$, where $\Sigma^{1/2} = \mathrm{diag}(Pw)$ (that is, the diagonal matrix whose elements are the vector $Pw$)?

-