The PyCuba(X) package provides a Python wrapper for the Cuba library, which offers a choice of four independent routines for multidimensional numerical integration: Vegas, Suave, Divonne, and Cuhre.
In the cloned repository, execute in shell
./make_sharedlib.sh
This creates libcuba.[a,so,dylib]
inside the dist/
folder.
Provided pip
is available as part of your Python environment, run
python -m pip install --editable . -vvv
to install in local editable mode.
Note
This automatically creates the shared library in the dist/
folder.
If the library remains there or is in system search paths, it should be
automatically discoverable; if for any reason it is moved to a
non-standard location, set the environmental variable LIBCUBA
to
its path before importing pycuba
.
Simply import the desired integration routine, e.g.
from pycuba import Vegas
As a demo, run
from pycuba import demo; demo()
See PyCuba documentation and repository for more details.
Tip
If you encounter an error about loading the Cuba library, see the note above
regarding the discoverability of libcuba
.
The Cuba
library is written by
Thomas Hahn
and is available at http://www.feynarts.de/cuba/
under the LGPLv3 licence.
The PyCuba
package is written by
Johannes Buchner
and is available as part of
PyMultiNest
under the GPLv3 licence.
Both libraries/packages have been modified and redistributed here under
the GLPv3+ licence. Changes are detailed in CHANGELOG.md
.
PyCubaX
is made freely available under the
GPLv3+ licence.
Please see LICENCE
for full terms and conditions.
© 2022 Thomas Hahn
© 2016 Johannes Buchner
© 2024 Mike S Wang