Gradient of Hadamard product I want to find the gradient of $\mathrm{trace}(A'(X\circ X-1))$ with respect to $X$, where $\circ$ is the Hadamard product, $A$ is the matrix of positive real values and $1$ is the matrix of all ones.
How can I do it ?

The inner/Frobenius product provides a nice infix notation for the trace operation
$${\rm tr}(A^TB)=A:B$$
Use this to rewrite the function, then find the differential and gradient
$$\eqalign{
 f &= A:(X\circ X) - A:1 \cr\cr
df &= A:d(X\circ X) - 0 \cr
 &= A:2(X\circ dX) \cr
 &= 2(A\circ X):dX \cr\cr
\frac{\partial f}{\partial X} &= 2A\circ X \cr\cr
}$$
