Skip to content

A new Python wrapper for the Cuba library

License

GPL-3.0, LGPL-3.0 licenses found

Licenses found

GPL-3.0
LICENCE
LGPL-3.0
COPYING
Notifications You must be signed in to change notification settings

MikeSWang/PyCubaX

Repository files navigation

PyCuba(X): a new Python wrapper for the Cuba library

Release CI

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.

Installation

Cuba library

In the cloned repository, execute in shell

./make_sharedlib.sh

This creates libcuba.[a,so,dylib] inside the dist/ folder.

PyCuba(X) package

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.

Usage

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.

Acknowledgement

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.

Licence

Licence

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