Skip to content

Commit db4bbad

Browse files
committed
Update readme
1 parent a977e76 commit db4bbad

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

README.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@
88
Python bindings for the [xtensor](https://github.com/QuantStack/xtensor) C++ multi-dimensional array library.
99

1010
- `xtensor` is a C++ library for multi-dimensional arrays enabling numpy-style broadcasting and lazy computing.
11-
- `xtensor-python` enables inplace use of numpy arrays with all the benefits from `xtensor`
11+
- `xtensor-python` enables inplace use of numpy arrays in C++ with all the benefits from `xtensor`
1212

1313
- C++ universal function and broadcasting
1414
- STL - compliant APIs.
15+
- A broad coverage of numpy APIs (see [the numpy to xtensor cheat sheet](http://xtensor.readthedocs.io/en/latest/numpy.html)).
1516

1617
The Python bindings for `xtensor` are based on the [pybind11](https://github.com/pybind/pybind11/) C++ library, which enables seemless interoperability between C++ and Python.
1718

@@ -42,6 +43,18 @@ These dependencies are automatically resolved when using the conda package manag
4243

4344
## Usage
4445

46+
xtensor-python offers two container types wrapping numpy arrays inplace to provide an xtensor semantics
47+
48+
- ``pytensor``
49+
- ``pyarray``.
50+
51+
Both containers enable the numpy-style APIs of xtensor (see [the numpy to xtensor cheat sheet](http://xtensor.readthedocs.io/en/latest/numpy.html)).
52+
53+
- On the one hand, ``pyarray`` has a dynamic number of dimensions. Just like numpy arrays, it can be reshaped with a shape of a different length (and the new shape is reflected on the python side).
54+
55+
- On the other hand ``pytensor`` has a compile time number of dimensions, specified with a template parameter. Shapes of ``pytensor`` instances are stack allocated, making ``pytensor`` a significantly
56+
faster expression than ``pyarray``.
57+
4558
### Example 1: Use an algorithm of the C++ library on a numpy array inplace.
4659

4760
**C++ code**

0 commit comments

Comments
 (0)