Fix membed with partial revert of 29943f
[gromacs.git] / src / external / lmfit / lmmin.h
blob17b4880c994445adc136e974e572e49cfad469e6
1 /*
2 * Library: lmfit (Levenberg-Marquardt least squares fitting)
4 * File: lmmin.h
6 * Contents: Declarations for Levenberg-Marquardt minimization.
8 * Copyright: Joachim Wuttke, Forschungszentrum Juelich GmbH (2004-2013)
10 * License: see ../COPYING (FreeBSD)
12 * Homepage: apps.jcns.fz-juelich.de/lmfit
15 #ifndef LMMIN_H
16 #define LMMIN_H
18 #include "lmstruct.h"
20 /*! \brief
21 * Levenberg-Marquardt minimization.
23 * This routine contains the core algorithm of our library.
25 * It minimizes the sum of the squares of m nonlinear functions
26 * in n variables by a modified Levenberg-Marquardt algorithm.
27 * The function evaluation is done by the user-provided routine 'evaluate'.
28 * The Jacobian is then calculated by a forward-difference approximation.
30 * Parameters:
32 * \param[in] n_par The number of variables (INPUT, positive integer).
33 * \param par The parameters to be fitted
34 * x is the solution vector (INPUT/OUTPUT, array of length n).
35 * On input it must be set to an estimated solution.
36 * On output it yields the final estimate of the solution.
38 * m is the number of functions to be minimized (INPUT, positive integer).
39 * It must fulfill m>=n.
41 * data is a pointer that is ignored by lmmin; it is however forwarded
42 * to the user-supplied functions evaluate and printout.
43 * In a typical application, it contains experimental data to be fitted.
45 * evaluate is a user-supplied function that calculates the m functions.
46 * Parameters:
47 * n, x, m, data as above.
48 * fvec is an array of length m; on OUTPUT, it must contain the
49 * m function values for the parameter vector x.
50 * userbreak is an integer pointer. When *userbreak is set to a
51 * nonzero value, lmmin will terminate.
53 * control contains INPUT variables that control the fit algorithm,
54 * as declared and explained in lmstruct.h
56 * status contains OUTPUT variables that inform about the fit result,
57 * as declared and explained in lmstruct.h
59 void lmmin( const int n_par, double *par, const int m_dat, const void *data,
60 void (*evaluate) (const double *par, const int m_dat, const void *data,
61 double *fvec, int *userbreak),
62 const lm_control_struct *control, lm_status_struct *status );
64 #endif /* LMMIN_H */