Let matrix $A$ be sparse and symmetric but not semidefinite. Since I would like to use projected gradient descent, I must find the gradient of $x \mapsto \frac{1}{2}(x^2)^\top A(x^2)$, where $x^2 = \operatorname{diag}(x)x$, $$\operatorname{diag}\begin{pmatrix} x_1 \\ x_2 \\ x_3 \end{pmatrix} = \begin{pmatrix} x_1 & 0 & 0 \\ 0 & x_2 & 0 \\ 0 & 0 & x_3 \end{pmatrix},$$ and $x \in \mathbb R^n$. How can I do it?
I know the cases where $x^2$ is replaced by $x$ but not this case.