Given $\mathbf{X} \in \mathbb{R}^{n \times 3}$, $\mathbf{A} \in \mathbb{R}^{n \times n}$, $\mathbf{1}\in \mathbb{R}^{3 \times 1}$ and $\mathbf{1}$ is a matrix with all the elements equal to 1. The function is $\mathbf{f}=\sqrt{\left(\mathbf{A} \mathbf{X} \odot \mathbf{A} \mathbf{X}\right)\mathbf{1}}$, where $\odot$ is Hadamard product, and $\sqrt{\cdot}$ is Hadamard root (elements-wise square root). How to compute $\frac{\partial \mathbf{f}}{\partial \mathbf{X}}$?
The above question has a specific meaning. The vector $\mathbf{f}$ can be seen as a length column vector, that is each element of which is a length of a vector, such as $\mathbf{f} = \left[\begin{array}{l} ||\mathbf{e}_{1}|| \\ ||\mathbf{e}_{2}|| \\ \vdots \\ ||\mathbf{e}_{n}|| \end{array}\right]$, where vector $\mathbf{e}_{i} = (x_{i}, y_{i}, z_{i})$. So $\frac{\partial \mathbf{f}}{\partial \mathbf{X}}$ is actually the derivative of the length of some vectors w.r.t it's coordinate.
Thanks a lot!
The derivative you ask is a third-order tensor. We can easily compute $\frac{\partial f_n}{\partial \mathbf{X}}$ where $f_n$ is the $n$-th component of the vector $\mathbf{f}$.
Note that $f_n = \| \mathbf{y}_n \|$ where $\mathbf{y}_n = \mathbf{a}_n \mathbf{X}$ is a 1-by-3 row vector and $\mathbf{a}_n$ is the $n$-th row vector of $\mathbf{A}$.
From here \begin{eqnarray*} df_n &=& \frac{1}{f_n} \mathbf{y}_n : d\mathbf{y}_n = \frac{1}{f_n} \mathbf{y}_n : \mathbf{a}_n d\mathbf{X} \end{eqnarray*} The colon operator stands for the Frobenius inner product. The derivative is thus
$$ \frac{\partial f_n}{\partial \mathbf{X}} = \frac{1}{\| \mathbf{a}_n \mathbf{X} \|} \mathbf{a}_n^T \mathbf{y}_n $$