@@ -10,7 +10,7 @@ Python bindings for the [xtensor](https://github.com/QuantStack/xtensor) C++ mul
1010 - ` xtensor ` is a C++ library for multi-dimensional arrays enabling numpy-style broadcasting and lazy computing.
1111 - ` xtensor-python ` enables inplace use of numpy arrays in C++ with all the benefits from ` xtensor `
1212
13- - C++ universal function and broadcasting
13+ - C++ universal function and broadcasting
1414 - STL - compliant APIs.
1515 - A broad coverage of numpy APIs (see [ the numpy to xtensor cheat sheet] ( http://xtensor.readthedocs.io/en/latest/numpy.html ) ).
1616
@@ -54,14 +54,12 @@ double sum_of_sines(xt::pyarray<double>& m)
5454 return std::accumulate(sines.begin(), sines.end(), 0.0);
5555}
5656
57- PYBIND11_PLUGIN (xtensor_python_test)
57+ PYBIND11_MODULE (xtensor_python_test, m )
5858{
5959 xt::import_numpy();
60- pybind11::module m("xtensor_python_test", "Test module for xtensor python bindings") ;
60+ m.doc() = "Test module for xtensor python bindings";
6161
6262 m.def("sum_of_sines", sum_of_sines, "Sum the sines of the input values");
63-
64- return m.ptr();
6563}
6664```
6765
8078
8179```
82801.2853996391883833
83- ```
81+ ```
8482
8583### Example 2: Create a universal function from a C++ scalar function
8684
@@ -99,13 +97,11 @@ double scalar_func(double i, double j)
9997 return std::sin(i) - std::cos(j);
10098}
10199
102- PYBIND11_PLUGIN (xtensor_python_test)
100+ PYBIND11_MODULE (xtensor_python_test, m )
103101{
104- py::module m("xtensor_python_test", "Test module for xtensor python bindings") ;
102+ m.doc() = "Test module for xtensor python bindings";
105103
106104 m.def("vectorized_func", xt::pyvectorize(scalar_func), "");
107-
108- return m.ptr();
109105}
110106```
111107
127123[[-0.540302, 1.257618, 1.89929 , 0.794764, -1.040465],
128124 [-1.499227, 0.136731, 1.646979, 1.643002, 0.128456],
129125 [-1.084323, -0.583843, 0.45342 , 1.073811, 0.706945]]
130- ```
126+ ```
131127
132128## Installation
133129
@@ -155,7 +151,7 @@ Testing `xtensor-python` requires `pytest`
155151 py.test .
156152 ```
157153
158- To pick up changes in ` xtensor-python ` while rebuilding, delete the ` build/ ` directory.
154+ To pick up changes in ` xtensor-python ` while rebuilding, delete the ` build/ ` directory.
159155
160156## Building the HTML Documentation
161157
@@ -169,7 +165,7 @@ While doxygen must be installed separately, you can install breathe by typing
169165
170166``` bash
171167pip install breathe
172- ```
168+ ```
173169
174170Breathe can also be installed with ` conda `
175171
0 commit comments