This repository is a demonstration of passing arbitrary-dimension tensors back and forth between python and C++, using pybind11. On the python side, numpy arrays are used. On the C++ side, Eigen tensors are used.
Note that Eigen is included as a git submodule. Therefore when you clone this repository, use the --recursive
flag:
git clone --recursive https://github.com/landreman/eigen_tensors.git
This repository provides a python extension named eigen_tensors
. To build and install the extension, you can run
pip install -v .
from the root directory of the repository. (The -v
flag provides verbose output). Note that CMake is required
to build the extension. After the extension is built and installed, tests can be run using
python -m unittest
from the repository's root directory.
Some resources I used to get this working: