27 #ifndef __templateLevmar_hpp__
28 #define __templateLevmar_hpp__
37 #define LM_DER_WORKSZ(npar, nmeas) (2*(nmeas) + 4*(npar) + (nmeas)*(npar) + (npar)*(npar))
38 #define LM_DIF_WORKSZ(npar, nmeas) (4*(nmeas) + 4*(npar) + (nmeas)*(npar) + (npar)*(npar))
43 #define LM_BC_DER_WORKSZ(npar, nmeas) (2*(nmeas) + 4*(npar) + (nmeas)*(npar) + (npar)*(npar))
44 #define LM_BC_DIF_WORKSZ(npar, nmeas) LM_BC_DER_WORKSZ((npar), (nmeas))
49 #define LM_LEC_DER_WORKSZ(npar, nmeas, nconstr) LM_DER_WORKSZ((npar)-(nconstr), (nmeas))
50 #define LM_LEC_DIF_WORKSZ(npar, nmeas, nconstr) LM_DIF_WORKSZ((npar)-(nconstr), (nmeas))
55 #define LM_BLEC_DER_WORKSZ(npar, nmeas, nconstr) LM_LEC_DER_WORKSZ((npar), (nmeas)+(npar), (nconstr))
56 #define LM_BLEC_DIF_WORKSZ(npar, nmeas, nconstr) LM_LEC_DIF_WORKSZ((npar), (nmeas)+(npar), (nconstr))
61 #define LM_BLEIC_DER_WORKSZ(npar, nmeas, nconstr1, nconstr2) LM_BLEC_DER_WORKSZ((npar)+(nconstr2), (nmeas)+(nconstr2), (nconstr1)+(nconstr2))
62 #define LM_BLEIC_DIF_WORKSZ(npar, nmeas, nconstr1, nconstr2) LM_BLEC_DIF_WORKSZ((npar)+(nconstr2), (nmeas)+(nconstr2), (nconstr1)+(nconstr2))
67 #define LM_INIT_MU 1E-03
68 #define LM_STOP_THRESH 1E-17
69 #define LM_DIFF_DELTA 1E-06
70 #define LM_VERSION "2.6 (November 2011)"
79 template<
typename floatT>
80 int levmar_dif(
void (*func)(floatT *p, floatT *hx,
int m,
int n,
void *adata),
94 int levmar_dif<double>(
void (*func)(
double *p,
double *hx,
int m,
int n,
void *adata),
108 int levmar_dif<float>(
void (*func)(
float *p,
float *hx,
int m,
int n,
void *adata),
121 template<
typename floatT>
122 int levmar_der(
void (*func)(floatT *p, floatT *hx,
int m,
int n,
void *adata),
123 void (*jacf)(floatT *p, floatT *j,
int m,
int n,
void *adata),
137 int levmar_der<double>(
void (*func)(
double *p,
double *hx,
int m,
int n,
void *adata),
138 void (*jacf)(
double *p,
double *j,
int m,
int n,
void *adata),
152 int levmar_der<float>(
void (*func)(
float *p,
float *hx,
int m,
int n,
void *adata),
153 void (*jacf)(
float *p,
float *j,
int m,
int n,
void *adata),