Debian Codegraph @

external/gsl/gsl_monte_vegas.h

raw
1 /* monte/gsl_monte_vegas.h
2 *
3 * Copyright (C) 1996, 1997, 1998, 1999, 2000 Michael Booth
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 3 of the License, or (at
8 * your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 */
19
20 /* header for the gsl "vegas" routines. Mike Booth, May 1998 */
21
22 #ifndef __GSL_MONTE_VEGAS_H__
23 #define __GSL_MONTE_VEGAS_H__
24
25 #include "gsl_rng.h"
26 #include "gsl_monte.h"
27
28 #undef __BEGIN_DECLS
29 #undef __END_DECLS
30 #ifdef __cplusplus
31 # define __BEGIN_DECLS extern "C" {
32 # define __END_DECLS }
33 #else
34 # define __BEGIN_DECLS /* empty */
35 # define __END_DECLS /* empty */
36 #endif
37
38 __BEGIN_DECLS
39
40 enum {GSL_VEGAS_MODE_IMPORTANCE = 1,
41 GSL_VEGAS_MODE_IMPORTANCE_ONLY = 0,
42 GSL_VEGAS_MODE_STRATIFIED = -1};
43
44 typedef struct {
45 /* grid */
46 size_t dim;
47 size_t bins_max;
48 unsigned int bins;
49 unsigned int boxes; /* these are both counted along the axes */
50 double * xi;
51 double * xin;
52 double * delx;
53 double * weight;
54 double vol;
55
56 double * x;
57 int * bin;
58 int * box;
59
60 /* distribution */
61 double * d;
62
63 /* control variables */
64 double alpha;
65 int mode;
66 int verbose;
67 unsigned int iterations;
68 int stage;
69
70 /* scratch variables preserved between calls to vegas1/2/3 */
71 double jac;
72 double wtd_int_sum;
73 double sum_wgts;
74 double chi_sum;
75 double chisq;
76
77 double result;
78 double sigma;
79
80 unsigned int it_start;
81 unsigned int it_num;
82 unsigned int samples;
83 unsigned int calls_per_box;
84
85 FILE * ostream;
86
87 } gsl_monte_vegas_state;
88
89 int gsl_monte_vegas_integrate(gsl_monte_function * f,
90 double xl[], double xu[],
91 size_t dim, size_t calls,
92 gsl_rng * r,
93 gsl_monte_vegas_state *state,
94 double* result, double* abserr);
95
96 gsl_monte_vegas_state* gsl_monte_vegas_alloc(size_t dim);
97
98 int gsl_monte_vegas_init(gsl_monte_vegas_state* state);
99
100 void gsl_monte_vegas_free (gsl_monte_vegas_state* state);
101
102 __END_DECLS
103
104 #endif /* __GSL_MONTE_VEGAS_H__ */
105