Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update xtensor includes #317

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ foreach(ver ${xtensor_python_version_defines})
set(XTENSOR_PYTHON_VERSION_${CMAKE_MATCH_1} "${CMAKE_MATCH_2}" CACHE INTERNAL "")
endif()
endforeach()
set(${PROJECT_NAME}_VERSION
set(${PROJECT_NAME}_VERSION
${XTENSOR_PYTHON_VERSION_MAJOR}.${XTENSOR_PYTHON_VERSION_MINOR}.${XTENSOR_PYTHON_VERSION_PATCH})
message(STATUS "xtensor-python v${${PROJECT_NAME}_VERSION}")

# Dependencies
# ============

set(xtensor_REQUIRED_VERSION 0.25.0)
set(xtensor_REQUIRED_VERSION 0.26.0)
if(TARGET xtensor)
set(xtensor_VERSION ${XTENSOR_VERSION_MAJOR}.${XTENSOR_VERSION_MINOR}.${XTENSOR_VERSION_PATCH})
# Note: This is not SEMVER compatible comparison
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,8 @@ from the `docs` subdirectory.

| `xtensor-python` | `xtensor` | `pybind11` |
|------------------|-----------|------------------|
| master | ^0.25.0 | >=2.6.1,<3 |
| 0.27.0 | ^0.25.0 | >=2.6.1,<3 |
| master | ^0.26.0 | >=2.6.1,<3 |
| 0.27.0 | ^0.26.0 | >=2.6.1,<3 |
| 0.26.1 | ^0.24.0 | ~2.4.3 |
| 0.26.0 | ^0.24.0 | ~2.4.3 |
| 0.25.3 | ^0.23.0 | ~2.4.3 |
Expand Down
4 changes: 2 additions & 2 deletions benchmark/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
#include "pybind11/numpy.h"
#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
#include "numpy/arrayobject.h"
#include "xtensor/xtensor.hpp"
#include "xtensor/xarray.hpp"
#include "xtensor/containers/xtensor.hpp"
#include "xtensor/containers/xarray.hpp"
#include "xtensor-python/pyarray.hpp"
#include "xtensor-python/pytensor.hpp"
#include "xtensor-python/pyvectorize.hpp"
Expand Down
2 changes: 1 addition & 1 deletion docs/source/basic_usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Example 1: Use an algorithm of the C++ library on a numpy array inplace

#include <numeric> // Standard library import for std::accumulate
#include "pybind11/pybind11.h" // Pybind11 import to define Python bindings
#include "xtensor/xmath.hpp" // xtensor import for the C++ universal functions
#include "xtensor/core/xmath.hpp" // xtensor import for the C++ universal functions
#define FORCE_IMPORT_ARRAY // numpy C api loading
#include "xtensor-python/pyarray.hpp" // Numpy bindings

Expand Down
2 changes: 1 addition & 1 deletion environment-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ dependencies:
- cmake
- ninja
# Host dependencies
- xtensor>=0.25,<0.26
- xtensor>=0.26,<0.26
- numpy>=2.0
- pybind11>=2.12.0,<3
# Test dependencies
Expand Down
6 changes: 3 additions & 3 deletions include/xtensor-python/pyarray.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
#include <cstddef>
#include <vector>

#include "xtensor/xbuffer_adaptor.hpp"
#include "xtensor/xiterator.hpp"
#include "xtensor/xsemantic.hpp"
#include "xtensor/containers/xbuffer_adaptor.hpp"
#include "xtensor/core/xiterator.hpp"
#include "xtensor/core/xsemantic.hpp"

#include "pyarray_backstrides.hpp"
#include "pycontainer.hpp"
Expand Down
2 changes: 1 addition & 1 deletion include/xtensor-python/pycontainer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#undef copysign

#include <cmath>
#include "xtensor/xcontainer.hpp"
#include "xtensor/containers/xcontainer.hpp"

#include "xtl/xsequence.hpp"

Expand Down
8 changes: 4 additions & 4 deletions include/xtensor-python/pytensor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
#include <array>
#include <cstddef>

#include "xtensor/xbuffer_adaptor.hpp"
#include "xtensor/xiterator.hpp"
#include "xtensor/xsemantic.hpp"
#include "xtensor/xutils.hpp"
#include "xtensor/containers/xbuffer_adaptor.hpp"
#include "xtensor/core/xiterator.hpp"
#include "xtensor/core/xsemantic.hpp"
#include "xtensor/utils/xutils.hpp"

#include "pycontainer.hpp"
#include "pystrides_adaptor.hpp"
Expand Down
2 changes: 1 addition & 1 deletion include/xtensor-python/pyvectorize.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include <type_traits>

#include "pyarray.hpp"
#include "xtensor/xvectorize.hpp"
#include "xtensor/core/xvectorize.hpp"

namespace xt
{
Expand Down
4 changes: 2 additions & 2 deletions include/xtensor-python/xtensor_type_caster_base.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
#include <algorithm>
#include <vector>

#include "xtensor/xtensor.hpp"
#include "xtensor/xfixed.hpp"
#include "xtensor/containers/xtensor.hpp"
#include "xtensor/containers/xfixed.hpp"

#include <pybind11/numpy.h>
#include <pybind11/pybind11.h>
Expand Down
4 changes: 2 additions & 2 deletions test/test_common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
#ifndef TEST_COMMON_HPP
#define TEST_COMMON_HPP

#include "xtensor/xlayout.hpp"
#include "xtensor/xmanipulation.hpp"
#include "xtensor/core/xlayout.hpp"
#include "xtensor/misc/xmanipulation.hpp"

#include "xtl/xsequence.hpp"

Expand Down
4 changes: 2 additions & 2 deletions test/test_pyarray.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@

#include "xtensor-python/pyarray.hpp"

#include "xtensor/xarray.hpp"
#include "xtensor/xview.hpp"
#include "xtensor/containers/xarray.hpp"
#include "xtensor/views/xview.hpp"

#include "test_common.hpp"

Expand Down
18 changes: 9 additions & 9 deletions test/test_pytensor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@

#include "xtensor-python/pytensor.hpp"

#include "xtensor/xtensor.hpp"
#include "xtensor/xview.hpp"
#include "xtensor/containers/xtensor.hpp"
#include "xtensor/views/xview.hpp"

#include "test_common.hpp"

Expand All @@ -22,13 +22,13 @@ namespace xt

TEST(pytensor, initializer_constructor)
{
pytensor<int, 3> t
{{{ 0, 1, 2},
{ 3, 4, 5},
{ 6, 7, 8}},
{{ 9, 10, 11},
{12, 13, 14},
{15, 16, 17}}};
pytensor<int, 3> t
{{{ 0, 1, 2},
{ 3, 4, 5},
{ 6, 7, 8}},
{{ 9, 10, 11},
{12, 13, 14},
{15, 16, 17}}};
EXPECT_EQ(t.dimension(), 3);
EXPECT_EQ(t(0, 0, 1), 1);
EXPECT_EQ(t.shape()[0], 2);
Expand Down
4 changes: 2 additions & 2 deletions test/test_sfinae.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
#include "gtest/gtest.h"
#include "xtensor-python/pytensor.hpp"
#include "xtensor-python/pyarray.hpp"
#include "xtensor/xarray.hpp"
#include "xtensor/xtensor.hpp"
#include "xtensor/containers/xarray.hpp"
#include "xtensor/containers/xtensor.hpp"

namespace xt
{
Expand Down
8 changes: 4 additions & 4 deletions test_python/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@

#include <numeric>

#include "xtensor/xmath.hpp"
#include "xtensor/xarray.hpp"
#include "xtensor/xfixed.hpp"
#include "xtensor/core/xmath.hpp"
#include "xtensor/containers/xarray.hpp"
#include "xtensor/containers/xfixed.hpp"
#define FORCE_IMPORT_ARRAY
#include "xtensor-python/pyarray.hpp"
#include "xtensor-python/pytensor.hpp"
Expand Down Expand Up @@ -336,7 +336,7 @@ PYBIND11_MODULE(xtensor_python_test, m)
m.def("array_subtraction", array_subtraction);
m.def("array_multiplication", array_multiplication);
m.def("array_division", array_division);

m.def("vectorize_example1", xt::pyvectorize(add));

m.def("rect_to_polar", xt::pyvectorize([](complex_t x) { return std::abs(x); }));
Expand Down