Let $p\in\mathbb{R}^d$ and $A\in \mathbb{R}^{d\times d}$, can the product $Ap$ be the derivative of some function?
In particular given a matrix $A$, how can I construct $H:\mathbb{R}^d\to \mathbb{R}$, such that $\nabla H(p)=Ap$. Note below I can do this for specific $A$ but I want it for general $A$ (say positive semi-definite, but possibly singular).
$\textbf{My Work :}$
If $A$ is the identity matrix then we have $\nabla H(p)=\nabla \frac{1}{2}\|p\|^2=p=Ap$.
If $A$ can be written as $B^TB$ for some matrix $B\in\mathbb{R}^{d\times d}$, then take $\nabla H(p)=\nabla \frac{1}{2}\|Bp\|^2=B^TBp=Ap$.
What about more general $A$?