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?
In the case $d=d_E$ you have $f_m=\sum w_i x_i$ (assuming $\sum w_i=1$, which can always be achieved by scaling the weights). Proof: for any $x\in\mathbb R^3$
$$\sum w_i\|x-p_i\|^2 = \sum w_i\|x-f_m+f_m-x_i\|^2 \\= \|x-f_m\|^2 + \sum w_i\|f_m-x_i\|^2 + 2\sum w_i\langle x-f_m, f_m-x_i\rangle$$ In the last term we move summation into the bracket to get $$\sum w_i\langle x-f_m, f_m-x_i\rangle=\langle x-f_m, f_m-\sum w_ix_i\rangle=0$$ Thus, $$\sum w_i\|x-p_i\|^2 =\|x-f_m\|^2+\sum w_i\|f_m-x_i\|^2\ge \sum w_i\|f_m-x_i\|^2 $$ QED
Also, if your metric is of the form $d(x,y)=\|\Phi(x)-\Phi(y)\|$ where $\Phi\colon\mathbb R^3\to\mathbb R^3$ is some invertible map, then $f_m=\Phi^{-1}(\sum w_i \Phi(x_i))$.