Levmar(C++版本)的资料-dlevmar_dif

学习目标:

记录一下levmar(c++ 版)的一些资料


学习内容:

官网网址为:http://users.ics.forth.gr/~lourakis/levmar/index.html

dlevmar_dif()函数接口说明

  • 类似于dlevmar_der(),不同的是Jacobian在内部借助有限差分进行近似。.
  • Broyden的一级更新用于计算雅可比的割线近似值,有效地避免了调用
  • ffunc多次用于计算有限差分近似。
  • 如果分析Jacobian可用,请使用上面的dlevmar_der()。
  • 如果成功,返回迭代次数(>=0),如果失败,返回-1

int dlevmar_dif(void (*func)(double *p, double *hx, int m, int n, void *adata),

  • func:描述测量的函数关系。
  • double p, / I/O:初始参数估计。输出包含估计的解决方案 */
  • double x, / I: 测量向量。NULL表示零向量 */
  • int m, /* I: 参数向量维度(即#未知数) */
  • int n, /* I: 测量矢量维数 */
  • int itmax, /* I:最大迭代次数 */
  • double opts[5], /* I:opts[0-4]=最小值。选项[\tau,\epsiln1,\epsilon2,\epsin3,\delta]。分别为||J^T e||_inf、||Dp||_2和||e||_2的初始\mu、停止阈值的比例因子和用于雅可比阶差近似的步长。如果δ<0,则用中心差来近似雅可比,与默认使用的前向差相比,中心差更准确(但更慢!)。设置为NULL以使用默认值。 /
    double info[LM_INFO_SZ],
    /
    O: 关于最小化的信息。如果不在乎,则设置为NULL
    *info[0]=||e||2在初始p。
    *info[1-4]=[||e||_2,||J^T e||_inf,||Dp||_2、\mu/max[J^T J]_ii],所有这些都是在估计的p下计算的。
    *info[5]=#迭代,
    *info[6]=终止原因:1-被小梯度J^T e停止
    *2-由小Dp停止
    *3-被itmax停止
    *4-奇异矩阵。从当前p重新启动,增加\mu
    *5-不可能进一步减少误差。用增加的mu重新启动
    *6-由小||e||_2停止
    *7-被无效(即NaN或Inf)“func”值停止;用户错误
    *info[7]=#函数求值
    *info[8]=#雅可比评价
    *info[9]=解决的线性系统数,即减少误差的尝试数
    */
  • double work, / I: 工作内存,如果为NULL,则在内部分配。如果=NULL,假定指向
    *至少LM_DIF_WORKSZ(m,n)*大小(双)字节长的内存块
    */
  • double*covar,/*O:对应于LS解的协方差矩阵;假设指向mxm矩阵。
    *如果不需要,则设置为NULL。
    */
  • void adata) / I: 指向可能需要的附加数据的指针,未解释地传递给func。
    *如果不需要,则设置为NULL
    */

dlevmar_dif()函数的原文如下
/*

  • Similar to dlevmar_der() except that the Jacobian is approximated internally with the aid of finite differences.
  • Broyden’s rank one updates are used to compute secant approximations to the Jacobian, effectively avoiding to call
  • func several times for computing the finite difference approximations.
  • If the analytic Jacobian is available, use dlevmar_der() above.
  • Returns the number of iterations (>=0) if successful, -1 if failed

*/
int dlevmar_dif(
void (*func)(double *p, double *hx, int m, int n, void adata), / functional relation describing measurements.
* A p \in R^m yields a \hat{x} \in R^n
*/
double p, / I/O: initial parameter estimates. On output contains the estimated solution */
double x, / I: measurement vector. NULL implies a zero vector /
int m, /
I: parameter vector dimension (i.e. #unknowns) /
int n, /
I: measurement vector dimension /
int itmax, /
I: maximum number of iterations /
double opts[5], /
I: opts[0-4] = minim. options [\tau, \epsilon1, \epsilon2, \epsilon3, \delta]. Respectively the
* scale factor for initial \mu, stopping thresholds for ||J^T e||_inf, ||Dp||_2 and ||e||_2 and the
* step used in difference approximation to the Jacobian. If \delta<0, the Jacobian is approximated
* with central differences which are more accurate (but slower!) compared to the forward differences
* employed by default. Set to NULL for defaults to be used.
/
double info[LM_INFO_SZ],
/
O: information regarding the minimization. Set to NULL if don’t care
* info[0]= ||e||_2 at initial p.
* info[1-4]=[ ||e||_2, ||J^T e||_inf, ||Dp||_2, \mu/max[J^T J]_ii ], all computed at estimated p.
* info[5]= # iterations,
* info[6]=reason for terminating: 1 - stopped by small gradient J^T e
* 2 - stopped by small Dp
* 3 - stopped by itmax
* 4 - singular matrix. Restart from current p with increased \mu
* 5 - no further error reduction is possible. Restart with increased mu
* 6 - stopped by small ||e||_2
* 7 - stopped by invalid (i.e. NaN or Inf) “func” values; a user error
* info[7]= # function evaluations
* info[8]= # Jacobian evaluations
* info[9]= # linear systems solved, i.e. # attempts for reducing error
*/
double work, / I: working memory, allocated internally if NULL. If !=NULL, it is assumed to point to
* a memory chunk at least LM_DIF_WORKSZ(m, n)*sizeof(double) bytes long
*/
double covar, / O: Covariance matrix corresponding to LS solution; Assumed to point to a mxm matrix.
* Set to NULL if not needed.
*/
void adata) / I: pointer to possibly needed additional data, passed uninterpreted to func.
* Set to NULL if not needed
*/


猜你喜欢

转载自blog.csdn.net/qq_41823532/article/details/128911930