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


  • 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 \mu of J^{T}J+\mu I .
    • opts[1]: stopping threshold for || J^{T} e ||_{\inf}
    • opts[2]: stopping threshold for || DP ||_{2}
    • opts[3]: stopping threshold for || e ||_{2}
    • opts[4]: the step used in difference approximation to the Jacobian
  • double *covar: covariance matrix corresponding to its solution


  • double *p: pointer to the estimated parameter vector.
  • double info[LM_INFO_SZ]: information regarding the minimization.
    • info[0]: || e ||_2 at initial p.
    • info[1]: || e ||_2 at estimated p.
    • info[2]: || J^{T} e ||_{\inf} at estimated p.
    • info[3]: || Dp ||_2 at estimated p.
    • info[4]: \frac{\mu}{ ( J^{T} J )_{ii} } at estimated p.
    • info[5]: reason why LM converged.
    • info[6]: stopped by small || 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.
  • {\rm x} = {\rm func}( {\rm p}, {\rm adata} )
  • {\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);

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s