I have to find two 3D vectors, $j_1$ and $j2$ by least squares optimization over a set of vectors $g_1$ and $g_1$. Having the error function:
$e(t) = ||g_1(t) \times j_1||_2 - ||g_2(t) \times j_2||_2$
they follow the constraint:
$e(t) = 0\quad\forall t$
I have also (equation 1) that
$\frac{d(||g_1(t) \times j_1||_2)}{dj_1} = \frac{(g_1(t) \times j_1) \times g_1(t)}{||g_1(t) \times j_1||_2}$
Restricting $j_1$ and $j_2$ to be unit-length, they can be parametrised in spherical coordinates as:
$x := (\phi_1,\theta_1,\phi_2,\theta_2)$,
The algorithm works as follows:
1) Compute $j_1$ and $j_2$ converting $x$ to cartesian coordinates
2) Compute residuals $e_t = ||g_1(t) \times j_1||_2 - ||g_2(t) \times j_2||_2$
3) Use equation 1 and spherical-cartesian transform to calculate Jacobian $\frac{de}{dx}$
4) Update estimates of $j_1$ and $j_2$ using the pseudo-inverse of $\frac{de}{dx}$
My question is "how to get from $\frac{de}{dj}$ to $\frac{de}{dx}$?"
Do I just convert back to spherical coordinates? Or do I have to do something else?