I'm attempting to obtain a derivative for the following function by matrix $U$:
$$R = \sum_{i=1}^n||ƒ(s ⋅ U) ⋅ V ⋅ M_i - f(t ⋅ U) ⋅ V|| ^ 2$$
where $s \in \mathbb{R}^{1\times3}$, $t \in \mathbb{R}^{1\times3}$, $U \in \mathbb{R}^{3\times3}$, $V \in \mathbb{R}^{3\times3}$, $M_i \in \mathbb{R}^{3\times3}$
I wish to use the derivative for the gradient descent method.
Now when $f$ is scalar function ie. $f:\mathbb{R}\to\mathbb{R} $ there is no issue with evaluating derivative:
suppose that: $$g = ƒ(s ⋅ U) ⋅ V ⋅ M_i - f(t ⋅ U) ⋅ V$$
then:
$$\frac{\partial{R}}{\partial{U}} = 2\sum_{i=1}^ns^T \cdot ((g \cdot (V \cdot M_i)^T) ∘ \frac{\partial f}{\partial{U}}(s \cdot U)) - t^T \cdot ((g \cdot V^T) ∘ \frac{\partial f}{\partial{U}}(t \cdot U))$$
But when $f$ becomes a function of vector argument $f:\mathbb{R}^{1\times3}\to\mathbb{R}^{1x3}$ i.e. $f$ accepts a vector-row and results with vector row. In this case the derivative of $f$ becomes a Jacobian of $\mathbb{R}^{3\times3}$ and it becomes unclear on how to evaluate the Hadamard product with vector-row of size $\mathbb{R}^{1\times3}$ on the left hand side and $\mathbb{R}^{3\times3}$ Jacobian.
I cant wrap my head around this problem for a week already, can anyone aid me with some thoughts on the issue?