Python bindings for the xtensor C++ multi-dimensional array library.
xtensoris a C++ library for multi-dimensional arrays enabling numpy-style broadcasting and lazy computing.
xtensor-pythonenables inplace use of numpy arrays with all the benefits from
- C++ universal functions and broadcasting
- STL - compliant APIs.
The numpy to xtensor cheat sheet from the
xtensor documentation shows how numpy APIs translate to C++ with
The Python bindings for
xtensor are based on the pybind11 C++ library, which enables seemless interoperability between C++ and Python.
Enabling numpy arrays in your C++ libraries¶
In addition to the basic accessors and iterators of
xtensor containers, it also enables using numpy arrays with
xtensor’s expression system.
xtensor-python provides an API to create Universal functions from simple scalar functions from your C++ code.
Finally, a cookiecutter template project is provided. It takes care of the initial work of generating a project skeleton for a C++ extension based on
xtensor-python containing a few examples, unit tests and HTML documentation. Find out more about the xtensor-python-cookiecutter.
xtensor-python require a modern C++ compiler supporting C++14. The following C++ compilers are supported:
- On Windows platforms, Visual C++ 2015 Update 2, or more recent
- On Unix platforms, gcc 4.9 or a recent version of Clang
We use a shared copyright model that enables all contributors to maintain the copyright on their contributions.
This software is licensed under the BSD-3-Clause license. See the LICENSE file for details.
- Basic Usage
- Arrays and tensors
- Importing numpy C API
- Getting started with xtensor-python-cookiecutter