laserIMUCalibration
|
Levenberg-Marquardt minimization. More...
Go to the source code of this file.
Macros | |
#define | MIN(a, b) (((a)<=(b)) ? (a) : (b)) |
[brief description] More... | |
#define | MAX(a, b) (((a)>=(b)) ? (a) : (b)) |
[brief description] More... | |
#define | SQR(x) (x)*(x) |
[brief description] More... | |
#define | LM_MACHEP DBL_EPSILON /* resolution of arithmetic */ |
#define | LM_DWARF DBL_MIN /* smallest nonzero number */ |
#define | LM_SQRT_DWARF sqrt(DBL_MIN) /* square should not underflow */ |
#define | LM_SQRT_GIANT sqrt(DBL_MAX) /* square should not overflow */ |
#define | LM_USERTOL 30*LM_MACHEP /* users are recommended to require this */ |
Functions | |
void | lm_lmpar (int n, double *r, int ldr, int *ipvt, double *diag, double *qtb, double delta, double *par, double *x, double *sdiag, double *aux, double *xdi) |
[brief description] More... | |
void | lm_qrfac (int m, int n, double *a, int *ipvt, double *rdiag, double *acnorm, double *wa) |
[brief description] More... | |
void | lm_qrsolv (int n, double *r, int ldr, int *ipvt, double *diag, double *qtb, double *x, double *sdiag, double *wa) |
[brief description] More... | |
void | lm_print_pars (int nout, const double *par, double fnorm, FILE *fout) |
void | lmmin (int n, double *x, int m, const void *data, void(*evaluate)(const double *par, int m_dat, const void *data, double *fvec, int *userbreak), const lm_control_struct *C, lm_status_struct *S) |
Levenberg-Marquardt minimization. More... | |
double | lm_enorm (int n, const double *x) |
Refined calculation of Eucledian norm. More... | |
Variables | |
const lm_control_struct | lm_control_double |
Preset (and recommended) control parameter settings. More... | |
const lm_control_struct | lm_control_float |
Preset (and recommended) control parameter settings. More... | |
const char * | lm_infmsg [] |
Preset message texts. More... | |
const char * | lm_shortmsg [] |
Preset message texts. More... | |
Levenberg-Marquardt minimization.
Library lmfit (Levenberg-Marquardt least squares fitting)
License: FreeBSD
Definition in file lmmin.c.
#define LM_MACHEP DBL_EPSILON /* resolution of arithmetic */ |
#define LM_SQRT_DWARF sqrt(DBL_MIN) /* square should not underflow */ |
#define LM_SQRT_GIANT sqrt(DBL_MAX) /* square should not overflow */ |
#define LM_USERTOL 30*LM_MACHEP /* users are recommended to require this */ |
#define MAX | ( | a, | |
b | |||
) | (((a)>=(b)) ? (a) : (b)) |
#define MIN | ( | a, | |
b | |||
) | (((a)<=(b)) ? (a) : (b)) |
#define SQR | ( | x | ) | (x)*(x) |
double lm_enorm | ( | int | n, |
const double * | x | ||
) |
void lm_lmpar | ( | int | n, |
double * | r, | ||
int | ldr, | ||
int * | ipvt, | ||
double * | diag, | ||
double * | qtb, | ||
double | delta, | ||
double * | par, | ||
double * | x, | ||
double * | sdiag, | ||
double * | aux, | ||
double * | xdi | ||
) |
[brief description]
[long description]
n | [description] |
r | [description] |
ldr | [description] |
ipvt | [description] |
diag | [description] |
qtb | [description] |
delta | [description] |
par | [description] |
x | [description] |
sdiag | [description] |
aux | [description] |
xdi | [description] |
evaluate the function at the current value of par.
if the function is small enough, accept the current value of par. Also test for the exceptional cases where parl is zero or the number of iterations has reached 10.
compute the Newton correction.
depending on the sign of the function, update parl or paru.
compute an improved estimate for par.
Definition at line 586 of file lmmin.c.
void lm_print_pars | ( | int | nout, |
const double * | par, | ||
double | fnorm, | ||
FILE * | fout | ||
) |
void lm_qrfac | ( | int | m, |
int | n, | ||
double * | a, | ||
int * | ipvt, | ||
double * | rdiag, | ||
double * | acnorm, | ||
double * | wa | ||
) |
[brief description]
[long description]
m | [description] |
n | [description] |
a | [description] |
ipvt | [description] |
rdiag | [description] |
acnorm | [description] |
wa | [description] |
bring the column of largest norm into the pivot position.
compute the Householder transformation to reduce the j-th column of a to a multiple of the j-th unit vector.
apply the transformation to the remaining columns and update the norms.
Definition at line 813 of file lmmin.c.
void lm_qrsolv | ( | int | n, |
double * | r, | ||
int | ldr, | ||
int * | ipvt, | ||
double * | diag, | ||
double * | qtb, | ||
double * | x, | ||
double * | sdiag, | ||
double * | wa | ||
) |
[brief description]
[long description]
n | [description] |
r | [description] |
ldr | [description] |
ipvt | [description] |
diag | [description] |
qtb | [description] |
x | [description] |
sdiag | [description] |
wa | [description] |
determine a Givens rotation which eliminates the appropriate element in the current row of d.
compute the modified diagonal element of r and the modified element of ((q^T)*b,0).
accumulate the tranformation in the row of s.
store the diagonal element of s and restore the corresponding diagonal element of r.
Definition at line 952 of file lmmin.c.
void lmmin | ( | int | n_par, |
double * | par, | ||
int | m_dat, | ||
const void * | data, | ||
void(*)(const double *par, int m_dat, const void *data, double *fvec, int *userbreak) | evaluate, | ||
const lm_control_struct * | control, | ||
lm_status_struct * | status | ||
) |
Levenberg-Marquardt minimization.
This routine contains the core algorithm of our library. It minimizes the sum of the squares of m nonlinear functions in n variables by a modified Levenberg-Marquardt algorithm. The function evaluation is done by the user-provided routine 'evaluate'. The Jacobian is then calculated by a forward-difference approximation.
n_par | is the number of variables (INPUT, positive integer). |
par | is the solution vector (INPUT/OUTPUT, array of length n). On input it must be set to an estimated solution. On output it yields the final estimate of the solution. |
m_dat | is the number of functions to be minimized (INPUT, positive integer). It must fulfill m>=n. |
data | is a pointer that is ignored by lmmin; it is however forwarded to the user-supplied functions evaluate and printout. In a typical application, it contains experimental data to be fitted. |
evaluate | is a user-supplied function that calculates the m functions. |
fvec | is an array of length m; on OUTPUT, it must contain the m function values for the parameter vector x. |
userbreak | is an integer pointer. When *userbreak is set to a nonzero value, lmmin will terminate. |
control | contains INPUT variables that control the fit algorithm, as declared and explained in lmstruct.h |
status | contains OUTPUT variables that inform about the fit result, as declared and explained in lmstruct.h |
Definition at line 183 of file lmmin.c.
const lm_control_struct lm_control_double |
Preset (and recommended) control parameter settings.
double-precision
const lm_control_struct lm_control_float |
const char* lm_infmsg[] |
Preset message texts.