cepgen
is hosted by
Hepforge
,
IPPP Durham
CepGen
1.2.5
Central exclusive processes event generator
Toggle main menu visibility
Main Page
Related Pages
Modules
Packages
Package List
Package Members
All
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
Functions
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
x
y
Variables
a
b
c
d
e
f
g
h
i
k
l
m
n
p
r
s
t
v
w
x
Typedefs
Enumerations
Classes
Class List
Class Index
Class Hierarchy
Class Members
All
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Variables
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
Enumerations
Enumerator
b
c
d
e
f
g
h
i
l
m
n
o
p
r
t
u
w
Related Symbols
d
g
h
o
u
v
Files
File List
File Members
All
_
a
b
c
d
e
f
h
i
k
l
m
n
o
p
r
s
t
v
y
Functions
a
b
c
d
f
m
n
o
p
r
s
Variables
Typedefs
a
b
c
d
e
h
k
l
m
p
r
s
t
v
y
Macros
_
b
c
d
e
i
p
r
s
t
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Modules
Pages
Loading...
Searching...
No Matches
Vegas.py
Go to the documentation of this file.
1
6
7
import
vegas
8
9
10
def
integrate(f, num_dim: int, num_iter: int, num_warmup: int, num_calls: int, limits: list[tuple[float]]=[]):
11
limits = limits
if
len(limits) > 0
else
num_dim * [(0., 1.)]
12
integ = vegas.Integrator(limits)
13
def
f_pyarr(vars):
14
return
f(vars.tolist())
15
integ(f_pyarr, nitn=num_iter, neval=num_warmup)
16
res = integ(f_pyarr, nitn=num_iter, neval=num_calls)
17
return
(res.mean, res.sdev)
18
19
20
if
__name__ ==
'__main__'
:
21
import
math
22
print(integrate(
lambda
x: x[0]**2 + x[1]**2, 2, 10, 1000, 1000))
23
print(integrate(
lambda
x: math.sin(x[0]), 1, 10, 1000, 1000, [(0, math.pi)]))
python
IntegrationAlgos
Vegas.py
Generated on Mon Jul 29 2024 for CepGen by
1.9.7