Where:
- $\boldsymbol{X} \in \mathbb{R}^{d \times d}$.
- The function $\log \left( \cdot \right)$ is the element wise $\log$ function: $\boldsymbol{M} = \log \left( \boldsymbol{X} \right) \implies \boldsymbol{M} \left[ i, j \right] = \log \left( \boldsymbol{X} \left[ i, j\right] \right)$.
Is there a way to solve it by first solve the directional derivative and then derive the derivative? using:
$\nabla f\left(\boldsymbol{X}\right)\left[H\right]=\left\langle \boldsymbol{\nabla f\left(\boldsymbol{X}\right)},\boldsymbol{H}\right\rangle $
And using more elegant way to solve it, without "manually" calculating the derivative, the way I solved it here?:
$f\left(\boldsymbol{X}\right)=\left\langle \boldsymbol{A},\log\left(\boldsymbol{X}\right)\right\rangle =Tr(A^{T}\log\left(\boldsymbol{X}\right))=\sum_{i=1}^{d}\sum_{j=1}^{d}a_{ij}log(x_{ij})$
$\frac{\partial f}{\partial x_{i_{0}j_{0}}}=\frac{a_{i_{0}j_{0}}}{x_{i_{0}j_{0}}}\Longrightarrow\nabla f\left(\boldsymbol{X}\right)=A\circ Z$
Where $Z=\{Z\in\mathbb{R}^{dxd}|z_{ij}=\frac{1}{x_{ij}}\}$ and $\circ$ denotes element-wise multiplication.
Let $(\oslash)$ denote elementwise/Hadamard division and, as an alternative to the bra-ket notation, use $(:)$ to denote the matrix inner product $$A:B = \langle A,B\rangle$$ Then a summation-free derivation looks like $$\eqalign{ \def\LR#1{\left(#1\right)} \def\p{\partial} \def\grad#1#2{\frac{\p #1}{\p #2}} f &= A:\log(X) \\ df &= A:d\log(X) = A:\LR{dX\oslash X} = \LR{A\oslash X}:dX \\ \grad{f}{X} &= {A\oslash X} \\ }$$ where $df$ is the directional derivative (in the $dX$ direction).
You can also interpret $(df,dX)$ as differentials.