GeezerVison is showing github.com — Use xbuffer_adaptor · yssource/xtensor-python@9eb21db
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: .appveyor.yml +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -23,7 +23,7 @@ install: | 23 | 23 | - conda update -q conda | 24 | 24 | - conda info -a | 25 | 25 | - conda install gtest cmake -c conda-forge | 26 | | - - conda install xtensor==0.10.0 pytest numpy pybind11==2.1.1 -c conda-forge | | 26 | + - conda install xtensor==0.10.2 pytest numpy pybind11==2.1.1 -c conda-forge | 27 | 27 | - "set PYTHONHOME=%MINICONDA%" | 28 | 28 | - cmake -G "NMake Makefiles" -D CMAKE_INSTALL_PREFIX=%MINICONDA%\\Library -D BUILD_TESTS=ON -D PYTHON_EXECUTABLE=%MINICONDA%\\python.exe . | 29 | 29 | - nmake test_xtensor_python | |
Collapse file Copy file name to clipboardExpand all lines: .travis.yml +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -94,7 +94,7 @@ install: | 94 | 94 | - conda update -q conda | 95 | 95 | # Useful for debugging any issues with conda | 96 | 96 | - conda info -a | 97 | | - - conda install xtensor==0.10.0 pytest numpy pybind11==2.1.1 -c conda-forge | | 97 | + - conda install xtensor==0.10.2 pytest numpy pybind11==2.1.1 -c conda-forge | 98 | 98 | - cd test | 99 | 99 | - conda env create -f ./test-environment.yml | 100 | 100 | - source activate test-xtensor-python | |
Collapse file Copy file name to clipboardExpand all lines: CMakeLists.txt +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -33,8 +33,8 @@ message(STATUS "xtensor-python v${${PROJECT_NAME}_VERSION}") | 33 | 33 |
| 34 | 34 | set(XTENSOR_PYTHON_HEADERS | 35 | 35 | ${XTENSOR_PYTHON_INCLUDE_DIR}/xtensor-python/pyarray.hpp | 36 | | - ${XTENSOR_PYTHON_INCLUDE_DIR}/xtensor-python/pybuffer_adaptor.hpp | 37 | 36 | ${XTENSOR_PYTHON_INCLUDE_DIR}/xtensor-python/pycontainer.hpp | | 37 | + ${XTENSOR_PYTHON_INCLUDE_DIR}/xtensor-python/pystrides_adaptor.hpp | 38 | 38 | ${XTENSOR_PYTHON_INCLUDE_DIR}/xtensor-python/pytensor.hpp | 39 | 39 | ${XTENSOR_PYTHON_INCLUDE_DIR}/xtensor-python/pyvectorize.hpp | 40 | 40 | ${XTENSOR_PYTHON_INCLUDE_DIR}/xtensor-python/xtensor_python_config.hpp | |
Collapse file Copy file name to clipboardExpand all lines: README.md +3-3Lines changed: 3 additions & 3 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -49,15 +49,15 @@ Both containers enable the numpy-style APIs of xtensor (see [the numpy to xtenso | 49 | 49 |
| 50 | 50 | double sum_of_sines(xt::pyarray<double>& m) | 51 | 51 | { | 52 | | - auto sines = xt::sin(m); // sines does not actually hold any value, which are only computed upon access | | 52 | + auto sines = xt::sin(m); // sines does not actually hold values. | 53 | 53 | return std::accumulate(sines.begin(), sines.end(), 0.0); | 54 | 54 | } | 55 | 55 |
| 56 | 56 | PYBIND11_PLUGIN(xtensor_python_test) | 57 | 57 | { | 58 | 58 | pybind11::module m("xtensor_python_test", "Test module for xtensor python bindings"); | 59 | 59 |
| 60 | | - m.def("sum_of_sines", sum_of_sines, "Computes the sum of the sines of the values of the input array"); | | 60 | + m.def("sum_of_sines", sum_of_sines, "Sum the sines of the input values"); | 61 | 61 |
| 62 | 62 | return m.ptr(); | 63 | 63 | } | @@ -189,7 +189,7 @@ from the `docs` subdirectory. | 189 | 189 |
| 190 | 190 | | `xtensor-python` | `xtensor` | `pybind11` | | 191 | 191 | |-------------------|------------|-------------| | 192 | | -| master | ^0.10.0 | ^2.1.0 | | | 192 | +| master | ^0.10.2 | ^2.1.0 | | 193 | 193 | | 0.11.x | ^0.10.0 | ^2.1.0 | | 194 | 194 | | 0.10.x | ^0.9.0 | ^2.1.0 | | 195 | 195 | | 0.9.x | ^0.8.1 | ^2.1.0 | | |
Collapse file Copy file name to clipboardExpand all lines: docs/source/basic_usage.rst +4-6Lines changed: 4 additions & 6 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -20,20 +20,18 @@ Example 1: Use an algorithm of the C++ library on a numpy array inplace | 20 | 20 | #define FORCE_IMPORT_ARRAY // numpy C api loading | 21 | 21 | #include "xtensor-python/pyarray.hpp" // Numpy bindings | 22 | 22 |
| 23 | | - double sum_of_sines(xt::pyarray<double> &m) | | 23 | + double sum_of_sines(xt::pyarray<double>& m) | 24 | 24 | { | 25 | | - auto sines = xt::sin(m); | 26 | | - // sines does not actually hold any value, which are only computed upon access | 27 | | - return std::accumulate(sines.begin(), sines.end(), 0.0); | | 25 | + auto sines = xt::sin(m); // sines does not actually hold values. | | 26 | + return std::accumulate(sines.cbegin(), sines.cend(), 0.0); | 28 | 27 | } | 29 | 28 |
| 30 | 29 | PYBIND11_PLUGIN(xtensor_python_test) | 31 | 30 | { | 32 | 31 | xt::import_numpy(); | 33 | 32 | pybind11::module m("xtensor_python_test", "Test module for xtensor python bindings"); | 34 | 33 |
| 35 | | - m.def("sum_of_sines", sum_of_sines, | 36 | | - "Computes the sum of the sines of the values of the input array"); | | 34 | + m.def("sum_of_sines", sum_of_sines, "Sum the sines of the input values"); | 37 | 35 |
| 38 | 36 | return m.ptr(); | 39 | 37 | } | |
Collapse file Copy file name to clipboardExpand all lines: include/xtensor-python/pyarray.hpp +5-3Lines changed: 5 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 12 | 12 | #include <cstddef> | 13 | 13 | #include <vector> | 14 | 14 | #include <algorithm> | | 15 | + | 15 | 16 | #include "xtensor/xsemantic.hpp" | 16 | 17 | #include "xtensor/xiterator.hpp" | | 18 | +#include "xtensor/xbuffer_adaptor.hpp" | 17 | 19 |
| 18 | 20 | #include "pycontainer.hpp" | 19 | | -#include "pybuffer_adaptor.hpp" | | 21 | +#include "pystrides_adaptor.hpp" | 20 | 22 |
| 21 | 23 | namespace xt | 22 | 24 | { | @@ -103,11 +105,11 @@ namespace xt | 103 | 105 | template <class T> | 104 | 106 | struct xcontainer_inner_types<pyarray<T>> | 105 | 107 | { | 106 | | - using container_type = pybuffer_adaptor<T>; | | 108 | + using container_type = xbuffer_adaptor<T>; | 107 | 109 | using shape_type = std::vector<typename container_type::size_type>; | 108 | 110 | using strides_type = shape_type; | 109 | 111 | using backstrides_type = pyarray_backstrides<pyarray<T>>; | 110 | | - using inner_shape_type = pybuffer_adaptor<std::size_t>; | | 112 | + using inner_shape_type = xbuffer_adaptor<std::size_t>; | 111 | 113 | using inner_strides_type = pystrides_adaptor<sizeof(T)>; | 112 | 114 | using inner_backstrides_type = backstrides_type; | 113 | 115 | using temporary_type = pyarray<T>; | |
|