Let $X$ be a set of $n$ points in $\mathbb{R}^3$ and $f_m$ be the Fréchet mean, i.e.:
$$ f_m= \arg \min_{p \in M} \sum_{i=1}^n w_id^2(p,x_i) $$
where $(\mathbb{R}^3,d)$ is a complete metric space, $d$ a distance function (Euclidean $d_E$, log-Euclidean $d_{log}$, Riemannian $d_R$) between any two points and $w$ a weight function.
$$ d_E(x_i,x_j)= \| x_i - x_j\| $$
$$ d_{log}(x_i,x_j)= \| \log(x_i) - \log(x_j)\| $$
$$ d_R(x_i,x_j)= \| \log(x_i^{-1/2}x_jx_i^{-1/2})\| $$
How could I solve this problem? Maybe by Gradient Descent?