Skip to content

Commit

Permalink
Merge pull request #47 from SylvainCorlay/versions
Browse files Browse the repository at this point in the history
Update to pybind11 2.1.0 and xtensor 0.8
  • Loading branch information
JohanMabille committed Mar 29, 2017
2 parents 6f3b761 + aee7349 commit 7ea59cc
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 33 deletions.
2 changes: 1 addition & 1 deletion .appveyor.yml
Expand Up @@ -24,7 +24,7 @@ install:
- conda info -a
- conda install pytest -c conda-forge
- cd test
- conda install xtensor==0.7.3 pytest numpy pybind11==2.0.1 -c conda-forge
- conda install xtensor==0.8.0 pytest numpy pybind11==2.1.0 -c conda-forge
- xcopy /S %APPVEYOR_BUILD_FOLDER%\include %MINICONDA%\include

build_script:
Expand Down
11 changes: 10 additions & 1 deletion .travis.yml
Expand Up @@ -35,6 +35,15 @@ matrix:
packages:
- clang-3.7
env: COMPILER=clang CLANG=3.7
- os: linux
addons:
apt:
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-precise-3.8
packages:
- clang-3.8
env: COMPILER=clang CLANG=3.8
- os: osx
osx_image: xcode8
compiler: clang
Expand All @@ -59,7 +68,7 @@ install:
# Useful for debugging any issues with conda
- conda info -a
- cd test
- conda install xtensor==0.7.3 pytest numpy pybind11==2.0.1 -c conda-forge
- conda install xtensor==0.8.0 pytest numpy pybind11==2.1.0 -c conda-forge
- cp -r $TRAVIS_BUILD_DIR/include/* $HOME/miniconda/include/

script:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -30,7 +30,7 @@ conda install -c conda-forge xtensor-python

| `xtensor-python` | `xtensor` | `pybind11` |
|-------------------|------------|-------------|
| master | 0.7.3 | ^2.0.0 |
| master | 0.8.0 | ^2.1.0 |
| 0.7.1 | 0.7.3 | ^2.0.0 |
| 0.7.0 | 0.7.2 | ^2.0.0 |
| 0.6.1 | 0.7.1 | ^2.0.0 |
Expand Down
32 changes: 2 additions & 30 deletions include/xtensor-python/pycontainer.hpp
Expand Up @@ -12,11 +12,11 @@
#include <functional>
#include <numeric>
#include <cmath>

#include "pybind11/pybind11.h"
#include "pybind11/common.h"
#include "pybind11/complex.h"

// Because of layout, otherwise xiterator and xtensor_forward are sufficient
#include "xtensor/xcontainer.hpp"

namespace xt
Expand Down Expand Up @@ -91,34 +91,6 @@ namespace xt

namespace detail
{
// TODO : switch on pybind11::is_fmt_numeric when it is available
template <typename T, typename SFINAE = void>
struct is_fmt_numeric
{
static constexpr bool value = false;
};

constexpr int log2(size_t n, int k = 0)
{
return (n <= 1) ? k : log2(n >> 1, k + 1);
}

template <typename T>
struct is_fmt_numeric<T, std::enable_if_t<std::is_arithmetic<T>::value>>
{
static constexpr bool value = true;
static constexpr int index = std::is_same<T, bool>::value ? 0 : 1 + (
std::is_integral<T>::value ? log2(sizeof(T)) * 2 + std::is_unsigned<T>::value : 8 + (
std::is_same<T, double>::value ? 1 : std::is_same<T, long double>::value ? 2 : 0));
};

template <class T>
struct is_fmt_numeric<std::complex<T>>
{
static constexpr bool value = true;
static constexpr int index = is_fmt_numeric<T>::index + 3;
};

template <class T>
struct numpy_traits
{
Expand All @@ -136,7 +108,7 @@ namespace xt

using value_type = std::remove_const_t<T>;

static constexpr int type_num = value_list[is_fmt_numeric<value_type>::index];
static constexpr int type_num = value_list[pybind11::detail::is_fmt_numeric<value_type>::index];
};
}

Expand Down

0 comments on commit 7ea59cc

Please sign in to comment.