This repository provides Python bindings for FastGPL, allowing users to evaluate Generalized Polylogarithms (GPLs) in Python without manually compiling C++.
Generalized Polylogarithms (GPLs) are a family of special functions defined by iterated integrals of the form:
where the recursion starts with
Conda is required to install pyGPL
. If you do not have Conda installed, you must install it first. The recommended way is to install Miniconda. Conda helps manage dependencies like pybind11
, cmake
, and librhash
, ensuring compatibility and preventing version conflicts. This is especially important on macOS, where librhash can cause build failures due to missing or mismatched shared libraries
Once installed, create and activate a new Conda environment:
conda create -n pygpl
conda activate pygpl
Clone the pyGPL
repository from GitHub:
git clone https://github.com/OscarBarreraGithub/pyGPL.git
cd pyGPL
Install the required dependencies using Conda:
conda install -c conda-forge pybind11 cmake
Compile and install the package:
mkdir build && cd build
cmake -DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX ..
make
make install
Return to the main directory and install the Python package:
cd ..
pip install .
If you encounter issues with librhash
when running CMake
, this is most likely due to a conflict in librhash
version between Cmake and Conda.
To verify the available librhash
shared libraries in your Conda environment, run:
ls -l $CONDA_PREFIX/lib/librhash*.dylib
To check which version CMake is trying to load:
otool -L $(which cmake)
It is possible that CMake is expecting librhash.0.dylib
while Conda has updated to librhash.1.dylib
. This is fixed by creating a symbolic link:
ln -s $CONDA_PREFIX/lib/librhash.1.dylib $CONDA_PREFIX/lib/librhash.0.dylib
Once installed, you can import and use pyGPL
in Python:
import pyGPL
To evaluate the Generalized Polylogarithm G[1, 4, 2, x] at x = 1.3, use:
pyGPL.GPL([complex(z) for z in [1, 4, 2]], 1.3)
See example usage in pyGPL/Example/
.
This project is based on FastGPL, developed by:
- Yuxuan Wang, Li Lin Yang, and Bin Zhou
- Original repository: FastGPL on GitHub
- For more details, see arXiv:2112.04122
FastGPL is a C++ library for fast GPL evaluation, and this project provides a Python wrapper using Pybind11.