You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -141,42 +140,6 @@ The full list of integration algorithms and wrappers can be consulted at: :ref:`
141
140
Tips and Tricks
142
141
===============
143
142
144
-
.. _simple-label:
145
-
146
-
Improving results by simplifying the integrand
147
-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
148
-
149
-
In the above example the integrand receives the keyword arguments `n_dim` and `xjac`.
150
-
Although these are useful for instance for filling histograms or dimensional-dependent integrands,
151
-
these extra argument can harm the performance of the integration when they are not being used.
152
-
153
-
It is possible to instantiate ``VegasFlow`` algorithms with ``simplify_signature``.
154
-
In this case the integrand will only receive the array of random numbers and, in exchange for this
155
-
loss of flexibility, the function will be retraced less often.
156
-
For more details in what function retracing entails we direct you to the `TensorFlow documentation <https://www.tensorflow.org/api_docs/python/tf/function>`_.
Copy file name to clipboardExpand all lines: doc/source/intalg.rst
+6-2Lines changed: 6 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -35,7 +35,10 @@ Once that is generated it is possible to register an integrand by calling the ``
35
35
.. code-block:: python
36
36
37
37
defexample_integrand(x, **kwargs):
38
-
return x
38
+
y =0.0
39
+
for d inrange(dims):
40
+
y += x[:,d]
41
+
return y
39
42
40
43
vegas_instance.compile(example_integrand)
41
44
@@ -44,6 +47,7 @@ After each iteration the grid will be refined, producing more points (and hence
44
47
45
48
.. code-block:: python
46
49
50
+
n_iter =3
47
51
result = vegas_instance.run_integration(n_iter)
48
52
49
53
The output variable, in this example named ``result``, is a tuple variable where the first element is the result of the integration while the second element is the error of the integration.
@@ -103,7 +107,7 @@ The usage pattern is similar to :ref:`vegas-label`.
0 commit comments