Reorganizing analysis of correlation functions.
[alexxy/gromacs.git] / src / external / lmfit / lmstruct.h
1 /*
2  * Library:   lmfit (Levenberg-Marquardt least squares fitting)
3  *
4  * File:      lmstruct.h
5  *
6  * Contents:  Declarations of parameter records, used in lmmin.h and lmcurve.h
7  *
8  * Copyright: Joachim Wuttke, Forschungszentrum Juelich GmbH (2004-2013)
9  *
10  * License:   see ../COPYING (FreeBSD)
11  *
12  * Homepage:  apps.jcns.fz-juelich.de/lmfit
13  */
14
15 #ifndef LMSTRUCT_H
16 #define LMSTRUCT_H
17 #undef __BEGIN_DECLS
18 #undef __END_DECLS
19 #ifdef __cplusplus
20 # define __BEGIN_DECLS extern "C" {
21 # define __END_DECLS }
22 #else
23 # define __BEGIN_DECLS /* empty */
24 # define __END_DECLS   /* empty */
25 #endif
26 __BEGIN_DECLS
27
28 #include <stdio.h>
29
30 /* Collection of input parameters for fit control. */
31 typedef struct {
32     double ftol;      /* Relative error desired in the sum of squares.
33                          Termination occurs when both the actual and
34                          predicted relative reductions in the sum of squares
35                          are at most ftol. */
36     double xtol;      /* Relative error between last two approximations.
37                          Termination occurs when the relative error between
38                          two consecutive iterates is at most xtol. */
39     double gtol;      /* Orthogonality desired between fvec and its derivs.
40                          Termination occurs when the cosine of the angle
41                          between fvec and any column of the Jacobian is at
42                          most gtol in absolute value. */
43     double epsilon;   /* Step used to calculate the Jacobian, should be
44                          slightly larger than the relative error in the
45                          user-supplied functions. */
46     double stepbound; /* Used in determining the initial step bound. This
47                          bound is set to the product of stepbound and the
48                          Euclidean norm of diag*x if nonzero, or else to
49                          stepbound itself. In most cases stepbound should lie
50                          in the interval (0.1,100.0). Generally, the value
51                          100.0 is recommended. */
52     int   patience;   /* Used to set the maximum number of function evaluations
53                          to patience*(number_of_parameters+1). */
54     int   scale_diag; /* If 1, the variables will be rescaled internally.
55                          Recommended value is 1. */
56     FILE* msgfile;    /* Progress messages will be written to this file. */
57     int   verbosity;  /* OR'ed: 1: print some messages; 2: print Jacobian. */
58     int   n_maxpri;   /* -1, or max number of parameters to print. */
59     int   m_maxpri;   /* -1, or max number of residuals to print. */
60 } lm_control_struct;
61
62 /* Collection of output parameters for status info. */
63 typedef struct {
64     double fnorm;     /* norm of the residue vector fvec. */
65     int    nfev;      /* actual number of iterations. */
66     int    outcome;   /* Status indicator. Nonnegative values are used as index
67                          for the message text lm_infmsg, set in lmmin.c. */
68     int    userbreak; /* Set when function evaluation requests termination. */
69 } lm_status_struct;
70
71 /* Preset (and recommended) control parameter settings. */
72 extern const lm_control_struct lm_control_double;
73 extern const lm_control_struct lm_control_float;
74
75 /* Preset message texts. */
76
77 extern const char *lm_infmsg[];
78 extern const char *lm_shortmsg[];
79
80 __END_DECLS
81 #endif /* LMSTRUCT_H */