rmjarvis / TreeCorr

Code for efficiently computing 2-point and 3-point correlation functions. For documentation, go to
http://rmjarvis.github.io/TreeCorr/
Other
97 stars 37 forks source link

Switch the C++ bindings from CFFI to pybind11 #155

Closed rmjarvis closed 1 year ago

rmjarvis commented 1 year ago

When I first wrote the python version of TreeCorr (in 2014), pybind11 didn't exist, so the easiest way to wrap things was via pure C functions using CFFI. And even for a while after that, compilers that supported C++-11 (required for pybind11) were not universally available.

But now, pybind11 is really by far the easier way to wrap C++ code so it is callable in Python. This PR converts all the boilerplate wrapping functions to use pybind11 rather than CFFI.

Along the way, I decided to change the base classes BinnedCorr2 and BinnedCorr3 to just Corr2 and Corr3, respectively. The "Binned" part doesn't add any useful information and just makes various bits of the code more wordy than they need to be. It's officially an API change, but it shouldn't affect any user code I don't think, since there's not really any reason to use the name of the base class explicitly.