- #1
vibe3
- 46
- 1
I have a nonlinear least squares problem with a set of parameters [itex]\bf{g}[/itex], where I need to minimize the function:
[tex]
\chi^2 = \sum_i \left( y_i - M(t_i ; {\bf g}) \right)^2
[/tex]
The [itex]t_i[/itex] are some independent parameters associated with the observations [itex]y_i[/itex] and the model function has the form
[tex]
M(t_i ; {\bf g}) = \sqrt{X(t_i; {\bf g})^2 + Y(t_i;{\bf g})^2}
[/tex]
The functions [itex]X(t_i;\bf{g})[/itex] and [itex]Y(t_i;\bf{g})[/itex] are linear in the model parameters [itex]\bf{g}[/itex], ie:
[tex]
X(t_i;{\bf g}) = \sum_k g_k X_k(t_i)
[/tex]
and
[tex]
Y(t_i;{\bf g}) = \sum_k g_k Y_k(t_i)
[/tex]
In order to solve the nonlinear least squares problem, I need to construct the matrix [itex]J^T J[/itex] at each iteration, where [itex]J[/itex] is the Jacobian:
[tex]
J_{ij} = - \frac{\partial}{\partial g_j} M(t_i;{\bf g})
[/tex]
My question is can anyone see a clever way to optimize the computation of the matrix [itex]J^T J[/itex], since all of the [itex]X_k(t_i)[/itex] and [itex]Y_k(t_i)[/itex] can be precomputed? I have millions of observations (rows of the Jacobian) and so its extremely slow to compute each row of the Jacobian and add it into the [itex]J^T J[/itex] matrix. I'm hoping that the linearity of the functions [itex]X[/itex] and [itex]Y[/itex] might allow some way to linearize or precompute large portions of the Jacobian matrix, but I don't see an easy way to do this.
[tex]
\chi^2 = \sum_i \left( y_i - M(t_i ; {\bf g}) \right)^2
[/tex]
The [itex]t_i[/itex] are some independent parameters associated with the observations [itex]y_i[/itex] and the model function has the form
[tex]
M(t_i ; {\bf g}) = \sqrt{X(t_i; {\bf g})^2 + Y(t_i;{\bf g})^2}
[/tex]
The functions [itex]X(t_i;\bf{g})[/itex] and [itex]Y(t_i;\bf{g})[/itex] are linear in the model parameters [itex]\bf{g}[/itex], ie:
[tex]
X(t_i;{\bf g}) = \sum_k g_k X_k(t_i)
[/tex]
and
[tex]
Y(t_i;{\bf g}) = \sum_k g_k Y_k(t_i)
[/tex]
In order to solve the nonlinear least squares problem, I need to construct the matrix [itex]J^T J[/itex] at each iteration, where [itex]J[/itex] is the Jacobian:
[tex]
J_{ij} = - \frac{\partial}{\partial g_j} M(t_i;{\bf g})
[/tex]
My question is can anyone see a clever way to optimize the computation of the matrix [itex]J^T J[/itex], since all of the [itex]X_k(t_i)[/itex] and [itex]Y_k(t_i)[/itex] can be precomputed? I have millions of observations (rows of the Jacobian) and so its extremely slow to compute each row of the Jacobian and add it into the [itex]J^T J[/itex] matrix. I'm hoping that the linearity of the functions [itex]X[/itex] and [itex]Y[/itex] might allow some way to linearize or precompute large portions of the Jacobian matrix, but I don't see an easy way to do this.