GCBM
|
#include <lmmin.h>
Public Types | |
typedef void() | lm_evaluate_ftype(double *par, int m_dat, double *fvec, void *data, int *info) |
typedef void() | lm_print_ftype(int n_par, double *par, int m_dat, double *fvec, void *data, int iflag, int iter, int nfev) |
Public Member Functions | |
void | lm_evaluate_default (double *par, int m_dat, double *fvec, void *data, int *info) |
void | lm_print_default (int n_par, double *par, int m_dat, double *fvec, void *data, int iflag, int iter, int nfev) |
void | lm_initialize_control (lm_control_type *control) |
double | lm_enorm (int, double *) |
void | lm_minimize (int m_dat, int n_par, double *par, lm_evaluate_ftype *evaluate, lm_print_ftype *printout, void *data, lm_control_type *control) |
void | lm_lmdif (int m, int n, double *x, double *fvec, double ftol, double xtol, double gtol, int maxfev, double epsfcn, double *diag, int mode, double factor, int *info, int *nfev, double *fjac, int *ipvt, double *qtf, double *wa1, double *wa2, double *wa3, double *wa4, lm_evaluate_ftype *evaluate, lm_print_ftype *printout, void *data) |
void | lm_qrfac (int m, int n, double *a, int pivot, int *ipvt, double *rdiag, double *acnorm, double *wa) |
void | lm_qrsolv (int n, double *r, int ldr, int *ipvt, double *diag, double *qtb, double *x, double *sdiag, double *wa) |
void | lm_lmpar (int n, double *r, int ldr, int *ipvt, double *diag, double *qtb, double delta, double *par, double *x, double *sdiag, double *wa1, double *wa2) |
typedef void() lm_evaluate_ftype(double *par, int m_dat, double *fvec, void *data, int *info) |
typedef void() lm_print_ftype(int n_par, double *par, int m_dat, double *fvec, void *data, int iflag, int iter, int nfev) |
double lm_enorm | ( | int | n, |
double * | x | ||
) |
sum squares.
calculation of norm.
void lm_evaluate_default | ( | double * | par, |
int | m_dat, | ||
double * | fvec, | ||
void * | data, | ||
int * | info | ||
) |
void lm_initialize_control | ( | lm_control_type * | control | ) |
void lm_lmdif | ( | int | m, |
int | n, | ||
double * | x, | ||
double * | fvec, | ||
double | ftol, | ||
double | xtol, | ||
double | gtol, | ||
int | maxfev, | ||
double | epsfcn, | ||
double * | diag, | ||
int | mode, | ||
double | factor, | ||
int * | info, | ||
int * | nfev, | ||
double * | fjac, | ||
int * | ipvt, | ||
double * | qtf, | ||
double * | wa1, | ||
double * | wa2, | ||
double * | wa3, | ||
double * | wa4, | ||
lm_evaluate_ftype * | evaluate, | ||
lm_print_ftype * | printout, | ||
void * | data | ||
) |
outer: compute norm of scaled gradient and test for convergence.
void lm_lmpar | ( | int | n, |
double * | r, | ||
int | ldr, | ||
int * | ipvt, | ||
double * | diag, | ||
double * | qtb, | ||
double | delta, | ||
double * | par, | ||
double * | x, | ||
double * | sdiag, | ||
double * | wa1, | ||
double * | wa2 | ||
) |
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 0. 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.
void lm_minimize | ( | int | m_dat, |
int | n_par, | ||
double * | par, | ||
lm_evaluate_ftype * | evaluate, | ||
lm_print_ftype * | printout, | ||
void * | data, | ||
lm_control_type * | control | ||
) |
void lm_print_default | ( | int | n_par, |
double * | par, | ||
int | m_dat, | ||
double * | fvec, | ||
void * | data, | ||
int | iflag, | ||
int | iter, | ||
int | nfev | ||
) |
void lm_qrfac | ( | int | m, |
int | n, | ||
double * | a, | ||
int | pivot, | ||
int * | ipvt, | ||
double * | rdiag, | ||
double * | acnorm, | ||
double * | wa | ||
) |
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.
void lm_qrsolv | ( | int | n, |
double * | r, | ||
int | ldr, | ||
int * | ipvt, | ||
double * | diag, | ||
double * | qtb, | ||
double * | x, | ||
double * | sdiag, | ||
double * | wa | ||
) |
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 transpose)*b,0).
accumulate the tranformation in the row of s.
store the diagonal element of s and restore the corresponding diagonal element of r.