I am Charmie

メモとログ

function dlevmar_der() of levmar

int dlevmar_der( void (func)(double p, double x, int m, int n, void adata), void (jacf)(double p, double j, int m, int n, void adata), double p, double x, int m, int n, int itmax, double opts[4], double info[LM_INFO_SZ], double work, double covar, void *adata )

Inputs:

  • void (*func): pointer to objective function
  • void (*jacf): pointer to function computing Jacobian
  • double *p: pointer to the parameter vector. need to be initialized.
  • double *x: pointer to the observation vector. NULL means zero vector.
  • int m: dimension of the parameter vector.
  • int n: dimension of the observation vector.
  • int itmax: maximum number of iterations.
  • double opts[5]: options for minimization:
    • opts[0]: scale factor for initial $latex \mu $ of $latex J^{T}J+\mu I $.
    • opts[1]: stopping threshold for $latex || J^{T} e ||_{\inf}$
    • opts[2]: stopping threshold for $latex || DP ||_{2}$
    • opts[3]: stopping threshold for $latex || e ||_{2}$
    • opts[4]: the step used in difference approximation to the Jacobian
  • double *covar: covariance matrix corresponding to its solution

Outputs:

  • double *p: pointer to the estimated parameter vector.
  • double info[LM_INFO_SZ]: information regarding the minimization.
    • info[0]: $latex || e ||_2 $ at initial p.
    • info[1]: $latex || e ||_2 $ at estimated p.
    • info[2]: $latex || J^{T} e ||_{\inf} $ at estimated p.
    • info[3]: $latex || Dp ||_2 $ at estimated p.
    • info[4]: $latex \frac{\mu}{ ( J^{T} J )_{ii} } $ at estimated p.
    • info[5]: reason why LM converged.
    • info[6]: stopped by small $latex || e ||_2 $.
    • info[7]: number of execution of func.
    • info[8]: number of Jacobian evaluations.
    • info[9]: number of linear systems solved.
  • double *work: working memory.
  • double *covar: covariance matrix corresponding to its solution
  • void *adata: pointer to possibly needed additional data, passed uninterpreted to func.
  • $latex {\rm x} = {\rm func}( {\rm p}, {\rm adata} ) $
  • $latex {\rm jac} = {\rm jacf}( {\rm p}, {\rm adata} ) $

pseudo code is as follows:

  1. set adata
  2. set p
  3. set x = func(p, adata);
  4. initialize p_hat
  5. perform non-linear optimization dlevmar_der( func, jacf, p_hat, x, m, n, itmax, opts, info, work, covar, adata );
  6. compute x_hat = func(p_hat, adata);