Given $F,f:\mathbb R\to\mathbb R$ such that $F'=f$ and $\pmb a,\pmb b\in\mathbb R^n$, compute $$\frac{d}{d\pmb X}\left(\pmb a^T F\left(\pmb X\right)\pmb b\right)$$ where $\pmb X\in\mathbb R^{n\times n}$.
My guess is $\operatorname{diag}(\pmb b) f(\pmb X)^T\operatorname{diag}(\pmb a)$ but I would like to
(i) confirm it and
(ii) see if there's a better way than using indices.