27#ifndef __templateLevmar_hpp__
28#define __templateLevmar_hpp__
36#define LM_DER_WORKSZ( npar, nmeas ) ( 2 * ( nmeas ) + 4 * ( npar ) + ( nmeas ) * ( npar ) + ( npar ) * ( npar ) )
37#define LM_DIF_WORKSZ( npar, nmeas ) ( 4 * ( nmeas ) + 4 * ( npar ) + ( nmeas ) * ( npar ) + ( npar ) * ( npar ) )
42#define LM_BC_DER_WORKSZ( npar, nmeas ) ( 2 * ( nmeas ) + 4 * ( npar ) + ( nmeas ) * ( npar ) + ( npar ) * ( npar ) )
43#define LM_BC_DIF_WORKSZ( npar, nmeas ) \
44 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 ) \
62 LM_BLEC_DER_WORKSZ( ( npar ) + ( nconstr2 ), ( nmeas ) + ( nconstr2 ), ( nconstr1 ) + ( nconstr2 ) )
63#define LM_BLEIC_DIF_WORKSZ( npar, nmeas, nconstr1, nconstr2 ) \
64 LM_BLEC_DIF_WORKSZ( ( npar ) + ( nconstr2 ), ( nmeas ) + ( nconstr2 ), ( nconstr1 ) + ( nconstr2 ) )
69#define LM_INIT_MU 1E-03
70#define LM_STOP_THRESH 1E-17
71#define LM_DIFF_DELTA 1E-06
72#define LM_VERSION "2.6 (November 2011)"
81template <
typename floatT>
82int levmar_dif(
void ( *func )( floatT *p, floatT *
hx,
int m,
int n,
void *adata ),
95int levmar_dif<double>(
void ( *func )(
double *p,
double *
hx,
int m,
int n,
void *adata ),
108int levmar_dif<float>(
void ( *func )(
float *p,
float *
hx,
int m,
int n,
void *adata ),
120template <
typename floatT>
121int levmar_der(
void ( *func )( floatT *p, floatT *
hx,
int m,
int n,
void *adata ),
122 void ( *
jacf )( floatT *p, floatT *
j,
int m,
int n,
void *adata ),
135int levmar_der<double>(
void ( *func )(
double *p,
double *
hx,
int m,
int n,
void *adata ),
136 void ( *
jacf )(
double *p,
double *
j,
int m,
int n,
void *adata ),
149int levmar_der<float>(
void ( *func )(
float *p,
float *
hx,
int m,
int n,
void *adata ),
150 void ( *
jacf )(
float *p,
float *
j,
int m,
int n,
void *adata ),
constexpr floatT six_fifths()
Return 6/5 in the specified precision.