xtensor-stack / xtensor-python

Python bindings for xtensor
BSD 3-Clause "New" or "Revised" License
347 stars 58 forks source link

Add an example for sharing the memory buffer of the xarray between C++ and Python (numpy) #175

Closed yungyuc closed 5 years ago

yungyuc commented 5 years ago

113 added the ability to take the memory buffer of an xarray and share it with ndarray in Python, but there wasn't an example for how to do it. This PR adds an example in the pytest directory.

I also fixed some formatting and compatibilty issue with pybind11 2.3.

yungyuc commented 5 years ago

I originally thought numpy view binding (#130) is necessary, but it turned out the feature I needed is already in the code base.

yungyuc commented 5 years ago

Would someone be willing to take a look at this? If the fixes for pybind11 2.3 should be in a separate PR, I can close this and file two new ones.

SylvainCorlay commented 5 years ago

@yungyuc sorry for the late reply! I am looking at it now.