Debian Codegraph @

monte/gsl_monte_vegas.h

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